problem in adding tab bar in bottom of view in android
In my application I have a tab bar. It contains four tabs in which I am showing a list view. It was working fine, but now I need to shift the tab bar to the bottom of the screen. When I changed my code to show tab bar at the bottom of the view, list views are showing in full screen overlapping the tab bar as well.
Here is the sample code
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical" >
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#000000">
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Credit Balance"
android:background = "#55000000"
android:textColor = "#FF0033"
/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_con开发者_如何转开发tent"
**android:layout_alignParentBottom = "true"**/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</RelativeLayout>
</TabHost>
</FrameLayout>
I am adding 4 list views in 4 respective tabs with the following code
tabHost.addTab(tabHost.newTabSpec(NEW_TAB).setIndicator(NEW)
.setContent(new Intent(this, NEWActivity.class)));
Please can anyone suggest a solution to this?
Thanks
add this
android:layout_above="@android:id/tabs"
line to your FrameLayout and with
android:layout_alignParentBottom = "true"
in TabWidget
精彩评论