Reputation: 115
I have a button and animation with ImageView in main.xml. problems arise if the application is started button is covered by the ImageView.
how to make ImageView is behind the button?
thank you. . this is my code:
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/summer">
<Button
android:id="@+id/soal111"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_x="207dp"
android:layout_y="41dp"
android:background="@drawable/primarykey"
android:text=" "
android:textSize="8dp" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="119dp"
android:layout_y="29dp"
android:adjustViewBounds="true"
android:src="@drawable/awan1" />
Upvotes: 0
Views: 7511
Reputation: 2765
you can do something like this,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="@+id/imageView1"
android:src="@drawable/ic_launcher" android:layout_centerVertical="true"
android:layout_centerHorizontal="true"></ImageView>
<Button android:text="Button" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/button1"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"></Button>
</RelativeLayout>
Upvotes: 2
Reputation: 20031
//put your Image view first
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/summer">
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="119dp"
android:layout_y="29dp"
android:adjustViewBounds="true"
android:src="@drawable/awan1" />
<Button
android:id="@+id/soal111"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_x="207dp"
android:layout_y="41dp"
android:background="@drawable/primarykey"
android:text=" "
android:textSize="8dp" />
//remove the android:layout_x & y in both imageview and button.
Upvotes: 0