navigation-drawer

Navigation Drawer Below Toolbar

三世轮回 提交于 2019-12-17 04:17:33
问题 I am trying to get the navigation drawer to open below the toolbar. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/drawer_layout" tools:context=".MainActivity"> <RelativeLayout android:layout_width = "match_parent" android:layout_height = "wrap_content"> <include layout="@layout/toolbar" android:id="@+id

How to set custom ActionBar color / style?

眉间皱痕 提交于 2019-12-17 03:24:06
问题 I am using Android Navigation bar in my project, I want to change the top color in action bar to something red, How can i do that? I have something like this, and i want something like this, how can i achieve that? 回答1: You can define the color of the ActionBar (and other stuff) by creating a custom Style : Simply edit the res/values/styles.xml file of your Android project. For example like this: <resources> <style name="MyCustomTheme" parent="@android:style/Theme.Holo.Light"> <item name=

Navigation drawer: How do I set the selected item at startup?

隐身守侯 提交于 2019-12-17 02:53:16
问题 My code works perfectly: every time an item in Navigation Drawer is clicked the item is selected. Of course I want to start the app with a default fragment (home), but Navigation Drawer doesn't have the item selected. How can I select that item programmatically? public class BaseApp extends AppCompatActivity { //Defining Variables protected String LOGTAG = "LOGDEBUG"; protected Toolbar toolbar; protected NavigationView navigationView; protected DrawerLayout drawerLayout; private DateManager

Using LinearLayout instead of RecyclerView in DrawerLayout

ぐ巨炮叔叔 提交于 2019-12-14 03:23:11
问题 Since I'm using a fixed menu for the navigation drawer I tried to use LinearLayout in DrawerLayout's second child instead of RecyclerView/ListView to make it easier to code. But the result is a full-screen linearlayout. Is there any way to use a regular view (like linearlayout) in DrawerLayout? <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"

Hide app icon on navigation drawer home button

心不动则不痛 提交于 2019-12-14 03:16:05
问题 In my Nexus 5 (without physical buttons) it's alright, my action bar is as follow: This is what I want for all devices. Instead, in devices with physical buttons, this happens: What should I do to force to show always the home button without the app icon ? The code used to setup the ActionBar in my Activity (in the onCreate() method) is: private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar

How to close navigation drawer from an adapter class

久未见 提交于 2019-12-13 23:15:12
问题 I have a custom navigation drawer which contains buttons in gridview...I need to close the navigation drawer from the adapter class...OR is any other ways to close the drawer when i click a button in the gridview. Onclick is working perfectly but the navigation drawer is not closing... This is my adapter class... public class NavMenuGridViewAdapter extends ArrayAdapter<MenuGridItem>{ ArrayList<MenuGridItem> menuList = new ArrayList<>(); Context context; View activityHome; public

(Android) My simple navigation drawer fragment doesn't work-see the error picture

余生颓废 提交于 2019-12-13 19:16:08
问题 what happened to my navigation. i think theres a problem in my activity main.xml . in my navigation drawer theres a sent fragtment like if you click on the sent it will show a textview "Test" using this code. SentFragment.java public class SentFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view=inflater.inflate(R.layout.sent_layout, container,false); return view; } } and in getting the layout of

Add header Image in navigation drawer on android studio sample navigation drawer

僤鯓⒐⒋嵵緔 提交于 2019-12-13 18:37:53
问题 i need to add header image like this Post : can I add an image header in navigation drawer layout but, im using android studio sample navigation drawer for doing this. it is good or bad for design this ? and the better way or Compact way for doing this ? any suggestion ? thanks. 回答1: Can I add an Image Header in Navigation Drawer Layout? Yes you can add with no problems. If you use android studio navigation drawer or some thing else every thing are same. Some additional methods will be

How to programmaticallly remove submenu from navigation drawer in Android?

左心房为你撑大大i 提交于 2019-12-13 16:14:00
问题 I am developing an Android app. Firstly, let me tell you that I am not professional. What I am doing now is I am adding submenu to menu depending on a condition. But I need to do it very often in my app. But my problem is I added a submenu to the menu as first time. But second time when I update menu depending on condition, existing submenu is not removed and new submenu is appended to navigation drawer. How can I remove submenu that is programmatically added to menu? Why my code is not

Notification Bar is grey after implementing Nav Drawer

雨燕双飞 提交于 2019-12-13 11:40:30
问题 I am trying to learn implementations of Navigation Drawer in Android. In one activity, i have made the Navigation Drawer come under the Status Bar(transparent) and over the App Bar and everything works fine.(left Screenshot) In another activity in the same App, i am trying to create Navigation Drawer that pulls up under the App Bar. But here, the status bar turns grey for some reason(whether nav drawer is open or closed)(Right Screenshot). Other than this, everything seems fine. Below is the