navigation-drawer

How to specify fixed layout_marginLeft for smartphones and wrap_content for tablet for NavigationDrawer

白昼怎懂夜的黑 提交于 2019-12-25 19:06:50
问题 I have the below navigation drawer and I want to give layout_marginLeft as -64dp for smartphones and wrap_content for tablets. Please let me know how to do that?I don't want to create separate laytout.xml files for smartphone and tablets i.e I have only one layout.xml file. As of now I am specifying different dimension in dimes.xml files which are created for smartphones and tabs. <!-- The navigation drawer --> <android.support.design.widget.NavigationView android:id="@+id/navigation" android

Including drawer in all activities xml and calling them when clicked

自古美人都是妖i 提交于 2019-12-25 12:40:11
问题 I am working on an Android project in which I am using drawer for showing some always used activities. I have made sure that the activities dont need any special data, and can be started once logged in. But I dont know how to include the drawer in all XML files where I have my activities. I cannot find any good reference. Also, When I do that, how can i start the activity instead of using fragments. So, for example, below is an example of my RestaurantLists xml file and displaying users xml

NavigationDrawer with ActionBarSherlok

倾然丶 夕夏残阳落幕 提交于 2019-12-25 10:49:33
问题 Hey I am trying to use DrawerLayout with ActionBarSherlok but i am getting error 06-30 15:37:18.874: E/AndroidRuntime(1305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Priyesh/com.Priyesh.MainActivity}:android.view.InflateException: Binary XML file line #1: Error inflating class android.support.v4.widget.DrawerLayout here is my xml file <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout"

How to create Android Custom Striped Navigation Drawer?

霸气de小男生 提交于 2019-12-25 09:41:54
问题 I want to make Striped Navigation Drawer, How to create something just like this? 回答1: 1. Create a custom layout XML for your custom NavigationView . nav_custom_layout.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="

In Navigation drawer, how to refresh title and drawerlist when calling fragment from fragment?

无人久伴 提交于 2019-12-25 07:39:30
问题 I have a dumb question that I'm using navigation drawer for my android app. so everything works well so far. But now I need to call another fragment from a fragment. I can successfully replace the fragment, but i don't know how to change the actionbar title and drawer list selection. for example: in the drawerList i have "frag 1" and "frag 2" so in the MainActivity, i have selectitem(position) function to taking care of fragment replace, title change and also drawerlist selection change. So i

NavigationDrawer icon not showing up

人盡茶涼 提交于 2019-12-25 07:30:10
问题 I am implementing a very simple example of NavigationDrawer . The example works fine, but I have a strange problem. The icon for NavigationDrawer (generally ic_drawer ) does not show up in the ActionBar . I have tried using different icon images, but didn't achieved the desired result. Here's the code. The project has only one activity named MainActivity.java . public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mListView; private

Navigation Drawer Layout on all activities of the application

六月ゝ 毕业季﹏ 提交于 2019-12-25 04:39:16
问题 I have two activities - MainActivity for user login page, and the second activity displaying user details(projects made by user) in a ListView. I want to create a Navigation Drawer Layout that will appear in both activities. I found the solution here. But the problem is, my second activity extends ListActivity to display user details in ListView, so I cannot extend anything else. here is my second activity: public class ProjectList extends ListActivity { ArrayList<String> listItems = new

Cannot Resolve method maketext

拈花ヽ惹草 提交于 2019-12-25 04:37:20
问题 UPDATE When I use this code Toast.makeText(Lesson111.this, rb.getText(), Toast.LENGTH_SHORT).show(); Im recieving the error message saying cannot resolve method maketext. Then I saw this (The method makeText in the type Toast is not applicable for the arguments) I applied the code Toast.makeText(Lesson111.this.getActivity(), rb.getText(), Toast.LENGTH_SHORT).show(); instead of Toast.makeText(Lesson111.this, rb.getText(), Toast.LENGTH_SHORT).show(); . the error somehow went away. However, when

How to make navigation drawer without actionbar

谁说我不能喝 提交于 2019-12-25 04:37:16
问题 I am trying to implement navigation drawer without ActionBar . There is a small layout and inside it there is a button. When the button is clicked then the navigation drawer will open. The navigation drawer will be under the button. How can i implement this in android??? 回答1: To hide actionbar, simply do this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().hide(); } 回答2: Define your xml like this and you are done <android

Java runtime exception when using navigation drawer

随声附和 提交于 2019-12-25 03:52:50
问题 I am trying to run my project but it crashes upon load. I have my proguard here as it has been the source of all issues so far and my error below that. I have tried: reinstalling android studio clean build rebuild project deleting known references to missing classes My proguard file is as shown: -dontwarn android.net.http.** -dontwarn org.apache.http.** -dontwarn org.apache.httpcomponents.** -dontwarn org.apache.commons.codec.** -dontwarn com.android.build.transform.api.** -dontwarn org