navigation-drawer

How to open Navigation Drawer with no actionbar, open with just a button

百般思念 提交于 2019-11-27 11:07:34
I have a navigation bar without any actionbar (I don't want an actionbar). I'm trying to make it so that I have a button that can open the navigation drawer. I know there's a method called openDrawer for the DrawerLayout http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html#openDrawer(android.view.View) I didn't know how to use it, but i have tried making a button when click, runs this method: DrawerLayout mDrawerLayout = (DrawerLayout) getView().findViewById(R.id.drawer_layout); mDrawerLayout.openDrawer(mDrawerLayout); When i click it on it, it gives me a Java

Android ripple background color

主宰稳场 提交于 2019-11-27 11:06:23
问题 I am using a ripple effect on my navigation drawer. I have set it like this and applied it to my ListView: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true" android:drawable="@color/black_200" /> <item android:state_pressed="true" android:color="@color/black_200"> <ripple android:color="@color/black_400" /> </item> <item android:drawable="@color/white" /> </selector> I want the ripple background to remain the same like the normal

How can I change the NavigationView's item text size?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 10:43:48
Google recently released the android.support.design.widget.NavigationView widget as part of the com.android.support:design:22.2.0 library, which greatly simplified (and standardises) the process of creating a NavigationDrawer. However according to the design specs , the list item should be Roboto Medium, 14sp, 87% #000000 . The NavigationView exposes no textSize or textStyle to customise this. What are my options if I'm pedantic about maintaining the correct design specifications using the Google provided NavigationView (or customising it in any other way)? Since Android Support Library 22.2.1

How to slide the ActionBar along with the NavigationDrawer

帅比萌擦擦* 提交于 2019-11-27 10:42:05
What I want to do is slide the ActionBar along with the NavigationDrawer when the drawer is opened. I am currently not using any third party libraries and if at all possible I want to keep it that way. All i need is an implementation of method like: getActionBarView.slide(dp); This is the code I currently use to create the NavigationDrawer : mDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View view) { invalidateOptionsMenu(); // calling onPrepareOptionsMenu() to hide action bar icons }

Navigation Drawer : add headers in listview

萝らか妹 提交于 2019-11-27 10:35:30
问题 I have created a project with the new navigation drawer Object. I would like to customize the layout of the menu, to add another object like TextView, ImageView ... And for begining, i would like to modify the default layout which is composed only with one listview, by adding 2 or 3 headers in the listview. Today, i have tried to use "addHeaderView" but i think it's possible to use this only for adding one header. How can i do to add header and really customize my layout menu? Because, from

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

前提是你 提交于 2019-11-27 10:29:53
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); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab

How to properly design/style a Android Navigation Drawer [closed]

北城余情 提交于 2019-11-27 10:22:22
问题 Im having trouble find any resources on how to properly design a standard Navigation Drawer. I've got the below XML and am looking for ways to Populate multiple listviews, change font of text in listview etc. Im trying to design similar to some of the following designs. Im looking to find documents, Guides, code, examples or some direction besides referencing me to the Design doc . Im looking for more actual code on how to properly adapt this new Android Design pattern not just idea's of how

Why is my Android navigation drawer opening too wide?

你。 提交于 2019-11-27 09:53:02
I had a rather basic navigation drawer working pretty well -- a simple ListView. But I need a title above the selectable items, so (see below) modified the XML for the drawer to be a RelativeLayout containing a TextView for a title and then the ListView for the items. What resulted is quite strange. Even though I have specified the width for all 3 (RelativeLayout, TextView and ListView) to be 240dp, which was the width of the ListView when it represented the entire drawer's XML, it looks like this (ignore the volume control - didn't see that pop up). Notice the ListView is 240 dp wide, but the

Clicking hamburger icon on Toolbar does not open Navigation Drawer

此生再无相见时 提交于 2019-11-27 09:41:25
I have this nav drawer which was working perfectly fine. Refactoring my code I removed all onOptionsItemSelecteds in activities and made all activities inherit from a base activity which extends AppComplatActivity and implements all the necessary methods. After this clicking on hamburger icon does not work any more even though I have syncstate () and every thing. Any clues why this is not working? One of the activities: public class MainActivity extends BaseActivity implements SearchFilterFragment.OnFragmentInteractionListener { NavigationView navigationView; DrawerLayout drawerLayout; private

Android: Navigation-Drawer on all activities

喜欢而已 提交于 2019-11-27 08:47:55
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 drawerListViewItems = getResources().getStringArray(R.array.items); // get ListView defined in activity_main.xml