Advertisement
Guest User

Untitled

a guest
May 25th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <android.support.design.widget.CoordinatorLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. xmlns:app="http://schemas.android.com/apk/res-auto"
  5. xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
  6. android:layout_height="match_parent" android:fitsSystemWindows="true"
  7. tools:context=".MainActivity">
  8.  
  9. <android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
  10. android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">
  11.  
  12. <android.support.v7.widget.Toolbar android:id="@+id/toolbar"
  13. android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
  14. android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay"
  15. app:layout_scrollFlags="scroll|enterAlways"/>
  16.  
  17. <android.support.design.widget.TabLayout
  18. android:id="@+id/tabs"
  19. android:layout_width="match_parent"
  20. android:layout_height="wrap_content"
  21. app:tabMode="scrollable"
  22. app:tabGravity="fill"/>
  23. </android.support.design.widget.AppBarLayout>
  24.  
  25. <android.support.v4.view.ViewPager
  26. android:id="@+id/viewpager"
  27. android:layout_width="match_parent"
  28. android:layout_height="match_parent"
  29. app:layout_behavior="@string/appbar_scrolling_view_behavior" />
  30.  
  31. <include layout="@layout/content_main" />
  32.  
  33. </android.support.design.widget.CoordinatorLayout>
  34.  
  35. protected void onCreate(Bundle savedInstanceState) {
  36. super.onCreate(savedInstanceState);
  37. setContentView(R.layout.activity_main);
  38. toolbar = (Toolbar) findViewById(R.id.toolbar);
  39. setSupportActionBar(toolbar);
  40. viewPager = (ViewPager) findViewById(R.id.viewpager);
  41. setupViewPager(viewPager);
  42. tabLayout = (TabLayout) findViewById(R.id.tabs);
  43. tabLayout.setupWithViewPager(viewPager);
  44. //Some other code
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement