android tabs within fragment code example

Example 1: android studio tabbed activity

compile 'com.android.support:design:27.0.2'

Example 2: android studio tabbed activity

<?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"><include layout="@layout/app_bar" /><android.support.design.widget.TabLayoutandroid:id="@+id/tabLayout"android:layout_width="match_parent"android:layout_height="wrap_content"android:minHeight="?actionBarSize"app:tabGravity="fill"app:tabIndicatorColor="@color/white"app:tabIndicatorHeight="4dp"app:tabBackground="@color/colorPrimary"app:tabMode="fixed"></android.support.design.widget.TabLayout><android.support.v4.view.ViewPagerandroid:id="@+id/viewPager"android:layout_width="match_parent"android:layout_height="match_parent"></android.support.v4.view.ViewPager></LinearLayout>

Tags:

Misc Example