Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <android.support.v4.widget.DrawerLayout 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:id="@+id/drawer"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context="net.rhyboo.com.drawer_test.MainActivity">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
- </LinearLayout>
- <net.rhyboo.com.drawer_test.PuzzlePagerView
- android:layout_gravity="start"
- android:layout_height="match_parent"
- android:layout_width="240dp"
- android:background="@android:color/white"
- android:id="@+id/pager">
- </net.rhyboo.com.drawer_test.PuzzlePagerView>
- public class MainActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- DrawerLayout drawer=(DrawerLayout) findViewById(R.id.drawer);
- drawer.setScrimColor(getResources().getColor(R.color.gameMenuDim));
- PuzzlePagerView pager=(PuzzlePagerView)findViewById(R.id.pager);
- GameMenuPagerAdapter menuAdapter=new GameMenuPagerAdapter(getSupportFragmentManager());
- pager.setAdapter(menuAdapter);
- }
- }
- public class GameMenuPagerAdapter extends FragmentPagerAdapter {
- private GameMenuFragment gameMenu;
- public GameMenuPagerAdapter(FragmentManager fm) {
- super(fm);
- gameMenu=new GameMenuFragment();
- }
- @Override
- public Fragment getItem(int position) {
- Log.d("pager",position+"");
- switch (position) {
- case 0:
- return gameMenu;
- }
- return null;
- }
- @Override
- public int getCount() {
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement