drawer

extending navigation drawer activity to other activities

混江龙づ霸主 提交于 2019-11-28 10:09:25
I'm trying to create a navigation drawer activity so I can extend that activity and use the menu in all activities by following the answer given in this question Link but my test app keeps crashing, here's my code: BaseActivity.java public class BaseActivity extends Activity { public DrawerLayout drawerLayout; public ListView drawerList; public String[] layers; private ActionBarDrawerToggle drawerToggle; protected void onCreate(Bundle savedInstanceState) { // R.id.drawer_layout should be in every activity with exactly the same // id. drawerLayout = (DrawerLayout) findViewById(R.id.drawer

How to get view from drawer header layout with binding in activity?

那年仲夏 提交于 2019-11-28 09:38:00
So this is my activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <layout 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" tools:context="MainActivity" > <!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- As the main content

Animate drawer icon into arrow on setDisplayHomeAsUpEnabled?

主宰稳场 提交于 2019-11-28 03:51:46
I'm using setDisplayHomeAsUpEnabled in order to show the arrow instead of the drawer "burger" icon but it's not getting animated or anything. Instead it shows the arrow drawable instantaneously. Home screen: (Album 1) When you tap a movie: (Album 2) The thing is, the icon does the animation just fine when I slide the drawer, which makes me think that maybe I'm not supposed to use setDisplayHomeAsUpEnabled for this: (Album 3) Album: http://imgur.com/a/LkXbh Here's my drawer toggle code: Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); setSupportActionBar(toolbar);

disable the swipe gesture that opens the navigation drawer in android

♀尐吖头ヾ 提交于 2019-11-27 17:11:14
I've been following the navigation drawer guide by Google and I'd like to add it to an Activity with tabs and gestures. I'd like to disable the gesture to open the navigation drawer, does anyone have any idea how to do this? Tran Hieu You should use: mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); It work with me, The swipe to open the drawer was disabled. If it still won't work, check out the answer provided here . for locking you can do this: mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); and for unlock : mDrawerLayout.setDrawerLockMode

How to set onclick listener for a button in a fragment in android

試著忘記壹切 提交于 2019-11-27 16:42:33
问题 My app contains a form as shown in the following image: When I click on menu options button, the drawer opens as shown in the following image: I want the drawer to open when the button select location is pressed. My codes are RegisterBlood.java ... public class RegisterBlood extends Activity implements OnItemClickListener { DrawerLayout dLayout, dLayout2; ListView dList, dList2; ArrayAdapter<String> adapter, adapter2; String[] state_data2; String city = "", state = ""; Button location;

Using Navigation Drawer without TitleBar or ActionBar

眉间皱痕 提交于 2019-11-27 16:40:11
问题 I'm adding a Navigation Drawer to this app that I am developing and I have scoured the internet; forums, stackoverflow, android developer documentation, and still have not found a great answer for this. I know that it is possible to do this without using either of these things. What I am wondering is how. The NsMenuAdapter model uses a title, and then there are these functions getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); Which are clearly looking

How to get view from drawer header layout with binding in activity?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 05:48:24
问题 So this is my activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <layout 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" tools:context="MainActivity" > <!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer

extending navigation drawer activity to other activities

非 Y 不嫁゛ 提交于 2019-11-27 03:26:12
问题 I'm trying to create a navigation drawer activity so I can extend that activity and use the menu in all activities by following the answer given in this question Link but my test app keeps crashing, here's my code: BaseActivity.java public class BaseActivity extends Activity { public DrawerLayout drawerLayout; public ListView drawerList; public String[] layers; private ActionBarDrawerToggle drawerToggle; protected void onCreate(Bundle savedInstanceState) { // R.id.drawer_layout should be in

Android Navigation Drawer on top ActionBar

僤鯓⒐⒋嵵緔 提交于 2019-11-26 23:46:00
I'm trying to make the navigation drawer over the action bar when it was slide to the right like this app: [Removed] This is my main activity's layout: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout ...> <RelativeLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> ... </RelativeLayout> <fragment android:name="com...." android:layout_gravity="start" android:id="@id/navigation" android:layout_width="@dimen/navigation_menu_width" android:layout_height="fill_parent" /> </android.support.v4.widget.DrawerLayout

disable the swipe gesture that opens the navigation drawer in android

霸气de小男生 提交于 2019-11-26 18:54:21
问题 I've been following the navigation drawer guide by Google and I'd like to add it to an Activity with tabs and gestures. I'd like to disable the gesture to open the navigation drawer, does anyone have any idea how to do this? 回答1: You should use: mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); It worked for me, the swipe to open the drawer was disabled. If it still won't work, check out the answer provided here. 回答2: for locking you can do this: mDrawerLayout