I followed this tutorial. I have made simple change that shows TabLayout at bottom of screen.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_landing"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:background="@android:color/white" />
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs_landing"
style="@style/MyCustomTabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed" />
</LinearLayout>
Problem:-
TabIndicator
is showing at bottom of screen working well,Now I want to show that TabIndicator
at Top of Tabs rather than bottom.
Using custom layout we can do that as mentioned in tutorial but is there any xml attribute that will show TabIndicator
at top ?
In Android TabLayout is a new element introduced in Design Support library. It provides horizontal layout to display tabs on the screen. We can display more screens in a single screen using tabs. We can quickly swipe between the tabs.
Add this line to your TabLayout in XML
app:tabIndicatorGravity="top"
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