简体   繁体   中英

Android RelativeLayout alignParentRight does not properly align Imageview

I am trying to place my ImageView in the bottom right corner of my display. I would like for the image to expand dynamically for different size displays.

The image aligns properly when it is smaller and not set to expand, but when set it to fill_parent the image is moved to the left and no longer lines up flush with the right side of the display.

<?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>

How can I make the image take up as much room as possible and remain flush to the right side of the display?

将您的图像视图的比例类型设置为FIT_XY。

我知道这可能无法解决问题,但是如果您希望图像停留在底部,则可能需要将此图像添加到您的imageview android:layout_alignParentBottom="true"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM