navigation-drawer

Handling back press when using fragments in Android

99封情书 提交于 2019-12-04 07:40:50
问题 I am using Android Sliding Menu using Navigation Drawer in my application and Fragments are used in the app instead of Activities. When I open the drawer, click on an item a Fragment appears. I move from one fragment to another fragment using the following code: Fragment fragment = null; fragment = new GalleryFragment(selectetdMainMenu.getCategoryID()); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.addToBackStack("menuFrag"); ft.add(R.id.frame_container, fragment,

How to create custom navigation drawer which opens ListView adjacent to drawer onitemclick?

戏子无情 提交于 2019-12-04 07:32:01
I have created simple navigation drawer but when i came across navigation drawer like in image i am stuck . I have no idea how to achieve this kind of functionality. Here in this image "City" is item of navigation drawer and when i click on city it opens list just adjacent to it. Here are COMPLETE CODES , because i do not know details it may not really meet your requirements: first i like to show demo: string.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">NavigationDrawer</string> <string name="hello_world">Hello world!</string> <string name="action_settings"

no app bar and drawer in other activity except main

北战南征 提交于 2019-12-04 07:04:44
问题 main activity public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); initNavigationDrawer(); } public void initNavigationDrawer() { } no activity in mobile_form activity public class mobile_form extends AppCompatActivity { @Override protected void onCreate(Bundle

Android - Change tint background color to navigation drawer?

一世执手 提交于 2019-12-04 06:51:57
I'm working with Navigation Drawer and i need to change the color of tint background from black to green. any ideas? Try This : yourDrawerLayout.setScrimColor(Color.GREEN); You need update latest support library. latest version- 25.4.0 Add this repository in, allprojects { repositories { maven { url "https://maven.google.com" } } } Project level build.gradle Update your xml <android.support.design.widget.NavigationView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:background="@android:color/white"//Change background color

Android Studio Navigation Draw Activity

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 06:32:50
问题 I am creating an App with a Navigation Draw Activity. In android studio, after I start a new android activity project, I select Navigation draw activity. My question is, how to a change the background color of the navigation draw activity? Right now, the top part is green but the white part where the text and icons are is white and I want to change this white part to dark grey with white text. Thanks. Rob 回答1: Go to res -> layout -> activity_main.xml and add the following: <android.support

Control the Toolbar icon with NavigationDrawer

ⅰ亾dé卋堺 提交于 2019-12-04 06:25:09
问题 I'm currently using within my app the android.support.v7.widget.Toolbar and android.support.v4.widget.DrawerLayout . Everything is working right, but there is a slight thing I want to change its behaviour. When I open the drawer, the whole drawer occupies the space of the Toolbar . It would be nice that the Toolbar stays on top, like in the Google Music app . How can I achieve that? But the most important thing isn't the previous. At first, the icon which is loaded in the application is the

Navigation Drawer icon on the top right is showing Back arrow icon insted of Hamburger icon

冷暖自知 提交于 2019-12-04 05:10:48
I have Create a new android app with the Navigation Drawer Activity. When i execute the app, the icon on the right corner is showing the back Arrow but it has to be the 3 line's icon. The icon R.drawable.ic_drawer is this In NavigationDrawerFragment class. // ActionBarDrawerToggle ties together the the proper interactions // between the navigation drawer and the action bar app icon. mDrawerToggle = new ActionBarDrawerToggle( getActivity(), /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.navigation_drawer

Ripple effect on custom navigation drawer

自作多情 提交于 2019-12-04 04:49:42
I'm developing my first app providing to it the new material look. I'm a bit lost with this so I'm following some tutorials to implement things like Toolbar, Navigation Drawer, etc. I have to say that I'm doing it providing compatibility to pre-lollipop android versions, so I'm using support libraries. What concers to my question, is that I have just implemented the Navigation Drawer following one of this tutorials and using the following libraries for compatibility: support.v4.widget.DrawerLayout support.v7.widget.RecyclerView I think that the code implementation is too long to put it here,

Opening/Closing NavDrawer with invalidateOptionsMenu() cause onRestore call on SearchView and onQueryTextChange is called as well

雨燕双飞 提交于 2019-12-04 04:25:16
问题 I have a MainActivity with callbacks implementation of: DrawerListFragment.Callback ItemListFragment.Callbacks SearchView.OnQueryTextListener I have also added an ActionBar SearchView, and finally implemented OnQueryTextListener to change the listView of the listFragment at each kb type, but this works! Also, clicking an item on navDrawer generates a new/replace FragmentList transaction for the new type of itemsList. Now the problem. The ActionBar SearchView actually filters the current

Floating Action Button appears over Navigation Drawer

人盡茶涼 提交于 2019-12-04 04:21:05
So I am using https://github.com/neokree/MaterialNavigationDrawer for my navigation drawer and https://gist.github.com/Jogan/9def6110edf3247825c9 as my FAB implementation. When I open the navigation drawer, it does not cover the FAB, and the button appears on top of it. I would like to avoid hiding the button and showing it on drawer open/close as that is rather distracting. Any ideas on how to fix this? Edit: I am adding the FAB programmatically doing the following: fabButton = new FloatingActionButton.Builder(this) .withDrawable(getResources().getDrawable(R.drawable.ic_action_edit))