我對Android的一個imageview的,我想橫向配合和所有設備停留在一個地方(無論大小)設置ImageView的,以適應任何設備的Android
<ImageView
android:id="@+id/Image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:foregroundGravity="bottom"
android:gravity="bottom|center_horizontal"
android:scaleType="center"
android:src="@drawable/image" />
圖像是1280px
和我將它放置在屏幕的底部。但是,如果應用程序在平板電腦中打開,則圖像將移動到左側,而右側有一個巨大的空白區域。我試圖fitxy
但圖像扭曲。我不想將圖像設置爲背景。
如何確保應用程序在平板電腦中打開時,圖像仍處於居中且右側或左側沒有空白空間?
而不是android:src,嘗試使用android:background。 – Shekhar
你試過android:layout_width =「match_parent」 android:layout_height =「match_parent」? –