In my andriod app I have an image view and back and next button as shown below. It works fine. Now I want to draw an admob ad below the buttons or above the buttons but below the image. In any case I don’t want image to be cropped by ad or buttons.
Here is layout which have image and two buttons:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/Linear1">
<RelativeLayout android:id="@+id/relativeLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<ImageView android:id="@+id/katha_image"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginBottom="@dimen/menu_item_size"></ImageView>
<LinearLayout android:layout_width="fill_parent"
android:orientation="horizontal" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_gravity="bottom|center">
<Button android:id="@+id/Button_Back" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="50"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:text="@string/back"
android:textSize="@dimen/button_size" android:minWidth="75px"></Button>
<Button android:text="@string/next" android:textSize="@dimen/button_size"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="50" android:id="@+id/Button_Next"></Button>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
Please suggest.
PC
You’ll want to use
android:layout_aboveorandroid:layout_belowwith your elements in a RelativeLayout so that they don’t overlap.Then add
android:layout_above="@id/adView"on your ImageView to make it lay out above the ad.