[英]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.