drawerlayout

How to disable drawer option in specific fragments of an activity

℡╲_俬逩灬. 提交于 2019-12-04 16:18:59
I have an activity with 5 fragments, I used drawer layout in my activity for a drawer, but I want to use(enable) the drawer in only fragment 2 and I want to disable the drawer option in remaining fragments. Can any one help me how to do this? MichaelStoddart Put two methods in the your activity , one to disable the drawer and one to enable it again, like so: public void lockDrawer() { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); } public void unlockDrawer() { drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); } Then in your fragments onCreateView(...)

Vertical Scrolling Interrupted by Oversensitive DrawerLayout When Using DrawerLayout with a ListFragment

笑着哭i 提交于 2019-12-04 12:45:28
I'm attempting to use the DrawerLayout to display two fragments with the slideout fragment having a listview. I'm mostly following the example found on the developers site . I have everything almost working, however when scrolling through the listview, any left or right movements in the scrolling motion will cause the scrolling to be interrupted and the drawerLayout to move horizontally. Layout fragment A ------------------------------------- | | | | | | | | | | Content Fragment | Fragment A | | | | | | (ListView) | | | | | | | | | | -------------------------------------- My Activity.xml

toolbar not appearing in pre lollipop devices

房东的猫 提交于 2019-12-04 10:24:58
Toolbar is not appearing on pre lollipop devices. I'm using drawer layout with toolbar. The same toolbar works on other activities but not when used along with drawer layout. Activity with drawer layout and toolbar @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_screen); { /*supportChatImageButton = (ImageButton) findViewById(R.id.homeSupportChatImageButton); orderImageButton = (ImageButton) findViewById(R.id.homeOrderImageButton);*/ headerTextView = (TextView) findViewById(R.id.homeHeaderTextView);

How to create DrawerLayout programmatically

做~自己de王妃 提交于 2019-12-04 08:42:22
问题 I would like to translate this xml to java in my main activity, the output is navigation drawer. I need help only in this part, I finished the remaining parts. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <FrameLayout android:id="@+id/main" android:layout

Open second drawerlayout as a sub drawerlayout over the first

▼魔方 西西 提交于 2019-12-04 05:55:06
Android Studio 2.1.3 I have this design I am trying to follow. On the first drawerlayout I have a setttings options. When the user clicks, it will open a second drawerlayout like this below. The user can get back to the first by clicking on the arrow Main Menu . Is this possible? Many thanks for any suggestions It's unclear how exactly you wish to implement your drawer UI, so the following solution is rather generic, in that it should work with NavigationView s, RecyclerView s, or pretty much whatever type of View s you'd like. This solution uses a custom ViewSwitcher subclass that acts as a

CoordinatorLayout NullPointerException in onTouchEvent

自作多情 提交于 2019-12-04 04:05:28
I am getting NullPointerException in onTouchEvent of CoordinatorLayout . I am using DrawerLayout with CollapsingToolbarLayout of android support AppCompat v23.0.0 library. My observation is crash happen randomly while scrolling CollapsingToolbarLayout or click on drawer items. Is there anyone facing this issue? any work around to avoid this exception? Logcat: 08-22 15:16:34.657: E/AndroidRuntime(27596): java.lang.NullPointerException: Attempt to invoke virtual method 'float android.view.MotionEvent.getX()' on a null object reference 08-22 15:16:34.657: E/AndroidRuntime(27596): at android.view

Cannot resolve symbol DrawerLayout

若如初见. 提交于 2019-12-04 00:11:07
I'm trying to implement the Navigation Drawer as shown here: http://developer.android.com/training/implementing-navigation/nav-drawer.html#top My code seems to be ok, and My minimum and target levels in my manifest match the example, but it's telling me it can't find the following three references import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; Jaydipsinh Zala May be you have found your answer but i think its for those who still wants to know. so, here's my answer, For Android Studio: First of all

Horiziontal recyclerview on DrawerLayout

余生长醉 提交于 2019-12-03 16:31:00
This is my NavigationView 's layout <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/header" app:menu="@menu/meny" /> headerLayout has a horizontal RecyclerView which has some items that user can scroll on it. My problem is whenever I want to scroll in RecyclerView , drawerLayout is going to close . Is there any way to support horizontal RecyclerView on Drawerlayout ? You should disable intercepting touch event on DrawerLayout when user is

android官方控件DrawerLayout和Toolbar地配合使用

夙愿已清 提交于 2019-12-03 15:44:11
首先说下配置工作,因为现在Android机所采用的版本4.0以下都比较少了,所以我司的APP基本是把最低版本定在了4.0(3.0以Pad为主嘛,至于android的Pad,算了,不提也罢),否则会报“java.lang.IllegalArgumentException: AppCompat does not support the current theme features”的错误,[stackOverFlow上有相关错误](http://http://stackoverflow.com/questions/29784124/java-lang-illegalargumentexception-appcompat-does-not-support-the-current-theme)。下面上代码,首先是Style文件: //此处主题必须设置为Theme.AppCompat.NoActionBar,即隐藏ActionBar <resources> <!-- Base application theme. --> <style name="AppTheme.Base" parent="Theme.AppCompat.NoActionBar"> <item name="windowActionBar">false</item> <item name="android

NavigationDrawer的使用

佐手、 提交于 2019-12-03 15:43:59
一。Create a NavigationDrawer 创建Navigation Drawer需要用DrawerLayout 作为界面根控件。在DrawerLayout里面第一个View为当前界面主内容;第二个和第三个View为Navigation Drawer内容。如果当前界面只需要一个Navigation Drawer,则第三个View可以省略。 下面的例子中,有两个View ,第一个FramLayout是显示内容 的主要页面,第二个ListView 是NavigationDrawer的内容 。 <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"> <!-- the main content view --> <FrameLayout android:id ="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match