[英]Android RelativeLayout alignParentRight does not properly align Imageview
我試圖將ImageView放在顯示器的右下角。 我希望圖像可以動態擴展為不同大小的顯示器。
當圖像較小且未設置為展開時,圖像會正確對齊,但是將圖像設置為fill_parent時,圖像將移至左側,不再與顯示屏幕的右側對齊。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<SurfaceView
android:id="@+id/surface1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
></SurfaceView>
<ImageView
android:src="@+drawable/image_1_patched"
android:layout_height="fill_parent"
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_alignParentRight="true"
></ImageView>
</RelativeLayout>
如何使圖像占據盡可能多的空間並保持與顯示器右側齊平?
將您的圖像視圖的比例類型設置為FIT_XY。
我知道這可能無法解決問題,但是如果您希望圖像停留在底部,則可能需要將此圖像添加到您的imageview android:layout_alignParentBottom="true"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.