Android RelativeLayout alignParentRight未正确对齐Imageview
我正在尝试将ImageView放置在显示器的右下角。我希望图像能够动态展开以显示不同大小的显示器 当图像较小且未设置为展开时,图像将正确对齐,但当设置为填充时,图像将移到左侧,不再与显示器的右侧对齐Android RelativeLayout alignParentRight未正确对齐Imageview,android,android-relativelayout,alignment,Android,Android Relativelayout,Alignment,我正在尝试将ImageView放置在显示器的右下角。我希望图像能够动态展开以显示不同大小的显示器 当图像较小且未设置为展开时,图像将正确对齐,但当设置为填充时,图像将移到左侧,不再与显示器的右侧对齐 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="ho
<?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>
如何使图像占据尽可能多的空间并保持与显示器右侧齐平?将imageview的缩放类型设置为FIT_XY。将imageview的缩放类型设置为FIT_XY。我知道这可能无法解决问题,但如果您希望图像保持在底部,您可能希望将此添加到imageview
android:layout\u alignParentBottom=“true”
我知道这可能无法解决问题,但如果您希望图像保持在底部,您可能希望将此添加到imageviewandroid:layout\u alignParentBottom=“true”
我的fitCenter,但正如你所预料的那样,它把图像放在了中间。但是,fitEnd将图像对齐到右侧和底部。谢谢你给我指明了正确的方向。不用担心。我抄错标签了。根据您希望的缩放方式,有多个选项。fitXY,如果你不关心图像的纵横比。我厌倦了fitCenter,但正如你所料,它将图像保留在中心。但是,fitEnd将图像对齐到右侧和底部。谢谢你给我指明了正确的方向。不用担心。我抄错标签了。根据您希望的缩放方式,有多个选项。如果您不关心图像的纵横比,请选择fitXY。