navigation-drawer

Navigation Drawer closes on click

浪尽此生 提交于 2019-11-26 17:18:03
问题 I have implemented a Navigation Drawer but I am having some trouble getting it to function properly. When I click on position 1 or 2, it is not launching the new fragment. MainActivity.java public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; // nav drawer title private CharSequence mDrawerTitle; // used to store app title private CharSequence mTitle; // slide menu items private String[]

How can I control the activity's up button from a contained fragment?

吃可爱长大的小学妹 提交于 2019-11-26 17:15:38
问题 I'm building a pretty simple app. At it's core are 2 screens: 1) list-screen: a list of items 2) detail-screen: a detailed view of an item I used one Activity (which extends AppCompatActivity) with an Action-Bar, a Navigation-Drawer and a main-content part (a FrameLayout). I used 2 different fragments for the 2 screens: When opening the app I inflate the list-fragment into the main-content part. When an item in the list is clicked I inflate the detail-fragment into the main-content part and

Reduce space between menu groups inside navigation drawer

最后都变了- 提交于 2019-11-26 17:06:08
问题 I want to reduce the space between each menu group in the Navigation drawer (In the following image, space between the two lines). I've created a custom style and tried the following attributes <item name="android:paddingTop">0dp</item> <item name="android:paddingBottom">0dp</item> They only reduced the padding around the items text. Even the following attributes didn't worked <item name="android:layout_marginTop">0dp</item> <item name="android:layout_marginBottom">0dp</item> 回答1: I think you

How to put list items at the bottom of list view in Navigation Drawer like Foursquare

吃可爱长大的小学妹 提交于 2019-11-26 16:35:18
问题 I got a list view for navigation drawer, how can I put list item like "Add Friends", "Settings" align at the bottom of the list view. Update 1 I add a setting view to the footer view. View settingView = getLayoutInflater().inflate(R.layout.drawer_list_item, null); TextView textView = (TextView)settingView.findViewById(R.id.drawer_list_item_text_view); textView.setText("Settings"); drawerListView.addFooterView(settingView); The settings item appear at the last one in the list view successfully

ClassCastException android.widget.FrameLayout$LayoutParams to android.support.v4.widget.DrawerLayout$LayoutParams

删除回忆录丶 提交于 2019-11-26 16:04:41
问题 I'm working on the Navigation Drawer for Android. As per my requirement I was to display gridview and listview of items in the navigation drawer. I have created a linearLayout in the layout xml file and placed the two widgets(Grid view, and Listview) in the LinearLayout. When I run the file I'm getting the following error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.navigationdrawer3/com.example.navigationdrawer3.MainActivity}: java.lang.ClassCastException:

How to detect that the DrawerLayout started opening?

三世轮回 提交于 2019-11-26 15:51:54
问题 So I have tabs that I want to hide when the Navigation Drawer starts opening. The code I have hides them when it finished opening, but it's not what I want. mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close ) { @Override public void onDrawerClosed(View view) { invalidateOptionsMenu(); setActionBarMode(ActionBar.NAVIGATION_MODE_TABS); } @Override public void onDrawerOpened(View drawerView) { invalidateOptionsMenu()

Manage toolbar&#39;s navigation and back button from fragment in android

随声附和 提交于 2019-11-26 15:41:22
问题 All of my fragments are controlled through ActionBarActivity (mainActivity), inside mainActivity a DrawerLayout is implemented and all the child fragments are pushed through drawerLayout's list item click. The problem that I'm facing is after pushing a fragment through drawerLayout I want to change the drawer icon into back icon of ToolBar so that user can navigate to previous fragment and to handle the callback of android.R.id.home either inside the same fragment or inside the mainActivity.

Navigation drawer, handling the back button to go to previous fragments?

限于喜欢 提交于 2019-11-26 15:37:46
问题 I'm using the built in navigation drawer to run my app. I can't quite figure out how to handle the back button. When it's pressed I want it to load the very first fragment again. Fragment1. So when the app launches you see Fragment1 launched. They can then click on Fragment 2-5 to go to other pages. Within all of these pages I want the back button to take the user back to Fragment1. The only place the user should be able to exit the app via the back button is Fragment1. SInce it's all handled

How can I change the NavigationView&#39;s item text size?

纵饮孤独 提交于 2019-11-26 15:18:09
问题 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

DrawerLayout Double Drawer (Left and Right Drawers simultaneously)

╄→гoц情女王★ 提交于 2019-11-26 15:03:26
I have an application, in which i want to implement a double drawer - one from the left and one from the right. Left drawer is for app navigation, right drawer is for result filtering. So, the layout is like this: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match