Hello i have this layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:src="@drawable/head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:id="@+id/image1"
/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/scan"
android:text=""
android:layout_below="@+id/image1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mio_ad">
</LinearLayout>
</RelativeLayout>
there's no way i can put my #mio_ad at the bottom: it remains at the top. how can i? thanks.
If you have a relative layout that fills the whole screen you should be able to use android:layout_alignParentBottom to move the button to the bottom of the screen.
You can set the layout_height="0dp" of your header, footer and ScrollView and define a layout_weight . Just play around with the values until you find out which works best. The resulting heights of header and footer would dynamically change with the screensize.
LinearLayout is less used as compared to RelativeLayout. RelativeLayout is used more in applications. We can use LinearLayout inside RelativeLayout. We can also use RelativeLayout as a Child of LinearLayout.
@filthy_wizard: RelativeLayout is not deprecated. PercentRelativeLayout is deprecated.
android:layout_alignParentBottom="true"
use it!
Use Below XML Code for that, it may help you.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/llayout"
android:layout_above="@+id/mio_ad">
<ImageView
android:src="@drawable/head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:id="@+id/image1"/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/scan"
android:text=""
android:layout_below="@+id/image1" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mio_ad"
android:layout_alignParentBottom="true" >
</LinearLayout>
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With