How to set tabbar in bottom of the screen in Android?
-
22-06-2021 - |
Frage
Currently i am working tabbar application in Android. here i mentioned the code for your reference, I refer the web, some of the links Found (android:layout_alignParentBottom = "true") insert this line in TabWidget, but the tabbar visible in Top only, so please help me
Thanks in Advance
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#EBF1FF">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
=========> android:layout_alignParentBottom = "true" <=======
android:layout_height="wrap_content"
/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
Lösung
The android:layout_alignParentBottom = "true"
works only if the TabWidget
is inside a RelativeLayout
..
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_alignParentBottom = "true"
android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</RelativeLayout>
Andere Tipps
Just put the TabWidget
after the FrameLayout
.
And use android:tabStripEnabled="false"
to hide the strip under the tabwidget because it looks ugly when it's on the bottom.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow