Guest User

Untitled

a guest
Sep 16th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. <android.support.v4.widget.DrawerLayout
  2. xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:id="@+id/drawerLayout"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent">
  6. <!-- The main content view -->
  7. <FrameLayout
  8. android:id="@+id/content_frame"
  9. android:layout_width="match_parent"
  10. android:layout_height="match_parent" />
  11. <!-- The navigation drawer -->
  12. <ListView android:id="@+id/drawerList"
  13. android:layout_width="240dp"
  14. android:layout_height="match_parent"
  15. android:layout_gravity="start"
  16. android:choiceMode="singleChoice"
  17. android:divider="@android:color/transparent"
  18. android:dividerHeight="0dp"
  19. android:background="#FFF"/>
  20. </android.support.v4.widget.DrawerLayout>
  21.  
  22. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  23. xmlns:app="http://schemas.android.com/apk/res-auto"
  24. android:orientation="horizontal" android:layout_width="match_parent"
  25. android:layout_height="match_parent"
  26. android:background="@color/com_facebook_button_send_background_color"
  27. android:weightSum="1">
  28.  
  29.  
  30. <include
  31. android:id="@+id/app_bar"
  32. layout="@layout/app_bar"
  33. />
  34. <include
  35. android:id="@+id/drawerLayout"
  36. layout="@layout/navigation_bar_layout"/>
  37.  
  38. <LinearLayout
  39. android:layout_width="match_parent"
  40. xmlns:app="http://schemas.android.com/apk/res-auto"
  41. android:layout_height="match_parent"
  42. android:layout_below="@+id/app_bar"
  43. android:background="@color/com_facebook_button_send_background_color"
  44. >
  45.  
  46. <Button
  47. android:layout_width="1in"
  48. android:layout_height="1.1in"
  49. android:id="@+id/docs_button"
  50. android:layout_weight="0.17"
  51. android:layout_gravity="center"
  52. android:background="@drawable/docs"
  53. />
  54. ....
  55.  
  56. public class HomeActivity extends AppCompatActivity implements View.OnClickListener{
  57.  
  58. private static final String TAG = HomeActivity.class.getSimpleName();
  59.  
  60.  
  61. private Toolbar toolbar;
  62. private Button docsButton;
  63. private Button musicButton;
  64. private ListView drawerList;
  65. private DrawerLayout drawerLayout;
  66. private String [] drawerListValues;
  67.  
  68. @Override
  69. protected void onCreate(Bundle savedInstanceSate) {
  70.  
  71. Log.d(TAG ,"OnCreate() - Ini");
  72.  
  73. super.onCreate(savedInstanceSate);
  74.  
  75. setContentView(R.layout.home_layout);
  76. toolbar= (Toolbar) findViewById(R.id.app_bar);
  77. setSupportActionBar(toolbar);
  78. toolbar.setTitle(R.string.app_name);
  79. toolbar.setTitleTextColor(getResources().getColor(R.color.com_facebook_button_background_color_focused));
  80. drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
  81. drawerList = (ListView) findViewById(R.id.drawerList);
  82. drawerListValues = getResources().getStringArray(R.array.drawerList);
  83. drawerList.setAdapter(new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,drawerListValues));
Advertisement
Add Comment
Please, Sign In to add comment