Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <android.support.design.widget.CoordinatorLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
- android:layout_height="match_parent" android:fitsSystemWindows="true"
- tools:context=".MainActivity">
- <android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
- android:layout_width="match_parent" 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:popupTheme="@style/AppTheme.PopupOverlay"
- app:layout_scrollFlags="scroll|enterAlways"/>
- <android.support.design.widget.TabLayout
- android:id="@+id/tabs"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- app:tabMode="scrollable"
- app:tabGravity="fill"/>
- </android.support.design.widget.AppBarLayout>
- <android.support.v4.view.ViewPager
- android:id="@+id/viewpager"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- app:layout_behavior="@string/appbar_scrolling_view_behavior" />
- <include layout="@layout/content_main" />
- </android.support.design.widget.CoordinatorLayout>
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- toolbar = (Toolbar) findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- viewPager = (ViewPager) findViewById(R.id.viewpager);
- setupViewPager(viewPager);
- tabLayout = (TabLayout) findViewById(R.id.tabs);
- tabLayout.setupWithViewPager(viewPager);
- //Some other code
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement