我试图将我的ImageView放置在显示器的右下角。我希望图像能够针对不同尺寸的显示器进行动态扩展。Android RelativeLayout alignParentRight没有正确对齐Imagview
当图像较小但未设置展开时,图像正确对齐,但设置为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>
如何让图像占用尽可能多的空间并保持与显示屏右侧齐平?
谢谢。
我累fitCenter,但正如你可能想到的是左在中心的图像。但fitEnd将图像对齐到右侧和底部。谢谢你指出我朝着正确的方向。 – UnluckyDevil 2011-04-12 17:21:29
不用担心。我复制了错误的标签。根据您希望如何扩展的方式有多种选择。 fitXY如果您不关心图像的宽高比。 – James 2011-04-12 18:11:07