Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put image above another image in Android

I m trying to create a layout where there is image which is in background and another image which i m tring put on above of the background image,but the issue is i want to place second image above first one without loosing quality of second image .Now it is bit blur as below in 3rd image:

Here is my 2 Images :

Image 1: enter image description here

Image 2:

enter image description here

It looks this way :

enter image description here

third image is getting bit blur.. is it possible to make more clear image as result .

My Layout :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/image1"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

    <Button
        android:id="@+id/intentskip"
        android:layout_width="500dp"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/imageView1"
        android:background="@drawable/blank"
        android:visibility="visible" />

    <ImageView
        android:id="@+id/image2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:src="@drawable/frames_01521" />

</RelativeLayout>
like image 699
KOTIOS Avatar asked Jan 17 '26 18:01

KOTIOS


1 Answers

Try to use a FrameLayout such as following:

<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:focusable="false" >

    <ImageView
        android:id="@+id/img_first"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
    />

    <ImageView
        android:id="@+id/img_second"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
    />
</FrameLayout>

Read more and even more about FrameLayout and you will love it.

like image 192
J Jiang Avatar answered Jan 19 '26 19:01

J Jiang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!