I'm trying to use a tabbedActivity in android to create a simple app. I would like to put my tabs at the bottom of the screen.
Here is what i've got when creating my Activity with android studio.
What I would like, is the part with "SECTION 1 SECTION 2 SECTION 3" to be at the bottom of the screen.
Here is my xml file:
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
This code is wrapped in a CoordinatorLayout
.
The problem is that if I take the TabLayout
and put it after the viewPager, it is erased from the screen.
Anyone's got an idea please?
EDIT : Thanks to @Vivek Mishra answer, it works ! Thanks
Try to add ` android:layout_alignParentBottom= "true" property in your xml
You can set tabs at bottom using tabhost like this way,
MainActivity.java
OUTPUT :