2
當我有一個背景圖片:設置背景圖片的位置(即`背景位置x`和`背景位置y`在網頁)
<Image style={{flex: 1, width: null, height: null, resizeMode: 'cover'}} source={require('../images/background.png')}>
<!-- Children -->
</Image>
我期待我的形象,以覆蓋整個同時保持圖像的寬高比。 (爲什麼我使用width: null, height: null
見本SO question。)
然而,如果圖像寬度遠小於高度,該圖像是居中其中作物的頂部。
問題:如何讓圖像從頂部開始,而不是像網頁上的background-position: 50% 0
一樣?