开发者

Android RelativeLayout alignParentRight does not properly align Imageview

开发者 https://www.devze.com 2023-02-23 12:17 出处:网络
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.

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>
    <ImageVie开发者_JAVA技巧w 
        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?


Set the scaletype of your imageview to FIT_XY.


I know this may not solve the problem, but if you are wanting the image to stay on the bottom, you may want to add this to your imageview android:layout_alignParentBottom="true"

0

精彩评论

暂无评论...
验证码 换一张
取 消