Reputation: 6973
I have a linear layout in my main.xml which has a listview. Now I want to create a bottom bar below listview.
Bottombar has a background image and two buttons with their individual background images. I want to put these two buttons on common background image.
I have read that this can be achieved using FrameLayout. But since I am using LinearLayout as base layout in my main.xml, is there any way to this design using linearlayout ?
Upvotes: 0
Views: 1440
Reputation: 14206
This is an example of what you want to achieve simply using linearlayout and using weighting to get the bottom bar to display.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#FF0000FF"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dip"
android:orientation="horizontal"
android:layout_weight="1"
android:background="#FF00FF00"
>
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Button 1"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Button 2"
/>
</LinearLayout>
</LinearLayout>
And you can get the backgrounds just by changing the solid colors I've shown to something like:
android:background="@drawable/background.png"
Upvotes: 3