navigation-drawer

Android NavigationView menu group divider [duplicate]

怎甘沉沦 提交于 2019-11-26 19:17:11
问题 This question already has answers here : How to create a simple divider in the new NavigationView? (13 answers) Closed 2 years ago . Android support design library provide NavigationView: <android.support.design.widget.NavigationView ... app:menu="@menu/navigation_drawer_items" /> menu/navigation_drawer_items: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item .../> ... </group> <group android:checkableBehavior="single"> <item ..

How to change color of hamburger icon in material design navigation drawer

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 18:43:54
I am following this example http://www.androidhive.info/2015/04/android-getting-started-with-material-design/ and in this example it is showing hamburger icon white,i want to customize it and make it black,but i am not able to find anything to how to change it,can any one tell how to customize it? Manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="info.androidhive.materialdesign" > <uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>

Cannot catch toolbar home button click event

混江龙づ霸主 提交于 2019-11-26 18:37:55
I've implemented the newest appcompat library and using the Toolbar as action bar. But the problem is I cannot catch the home button / hamburger icon click event. I've tried and looked everything but doesn't seem to find a similar problem. This is my Activity class : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Set up the drawer. navDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id

Android - Switch ActionBar Back Button to Navigation Button

夙愿已清 提交于 2019-11-26 18:36:20
I am having the following problem: I know how to set up a toolbar to show a back button icon instead of a burger button icon. From this: to this: using: getSupportActionBar().setDisplayHomeAsUpEnabled(true); Now, I want to do the reverse action, I want to go from back button icon to burger icon: to here: How can I do this? Update: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); } private void enableViews(boolean enable) { if(enable) { // Enables back button

DrawerLayout must be measured with MeasureSpec.EXACTLY error

北城余情 提交于 2019-11-26 18:27:44
问题 I am trying to implement a Navigation drawer, but I keep getting this error. I saw the similar questions but did not work for me. I have the following layout activity_main2.xml: <android.support.v4.widget.DrawerLayout android:layout_width="match_parent" android:id="@+id/drawerLayout" android:layout_height="match_parent"> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"/> <RelativeLayout android

Navigation Drawer: set as always opened on tablets

两盒软妹~` 提交于 2019-11-26 18:21:33
I am using the Navigation Drawer pattern from the support library: http://developer.android.com/training/implementing-navigation/nav-drawer.html I was trying to set it as always opened on tablet (as a side menu) Is that something possible with the current implementation, or do we have to create a new layout and a new structure with a Listview instead of reusing the same code? Based on the idea of larger devices could have different layout files, I have created the follow project. https://github.com/jiahaoliuliu/ABSherlockSlides HighLights : Since the drawer of a large device is always visible,

How can I add a custom item to a NavigationView with a menu layout?

三世轮回 提交于 2019-11-26 18:01:55
问题 I've been experimenting with simplifying some navigation drawer code by making use of the new NavigationView class in the Android design support library. It works great if you just want icons on the left, and text on the right like in the example in the documentation, but what if I want to add a single custom view to the layout which has an android.support.v7.widget.SwitchCompat like in the Google Play Movies app (see screenshot below)? I've tried using the actionLayout attribute to specify a

Switch between Fragments with onNavigationItemSelected in new Navigation Drawer Activity template (Android Studio 1.4 onward)

给你一囗甜甜゛ 提交于 2019-11-26 17:57:19
问题 IntelliJ has made changes to the Navigation Drawer template Activity in Android Studio with fewer lines of code in the Activity class. The new Activity class looks like this: public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

Android: Navigation-Drawer on all activities

不羁岁月 提交于 2019-11-26 17:46:39
问题 I want to add navigation drawer on all actvities of my Android project. This is the code of the MainActivity: public class MainActivity extends Activity { private String[] drawerListViewItems; private DrawerLayout drawerLayout; private ListView drawerListView; private ActionBarDrawerToggle actionBarDrawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // get list items from strings.xml

Android Api 23 Change Navigation View headerLayout textview

一世执手 提交于 2019-11-26 17:36:55
问题 I am testing the Navigation Drawer sample project in android and i have a problem setting the text in navigation view profile header. This is my code: MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new