Tag: drawerlayout

在drawerlayout中是否可以使用除listview以外的东西作为滑动抽屉?

我想有例如一个LinearLayout或RelativeLayout从屏幕左侧而不是一个单独的ListView滑动。 我尝试使用LinearLayout与android:layout_gravity="start" ,我在运行时有这个错误: ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams 这是布局文件: <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" android:background="@android:color/white" > <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /> <LinearLayout android:layout_width="320dp" android:layout_height="match_parent" android:layout_gravity="start" android:orientation="vertical"> <ImageView android:id="@+id/ivwLogo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/video_icon" /> <ListView android:id="@+id/left_drawer" android:layout_width="320dp" android:layout_height="match_parent" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="@android:color/white" /> </LinearLayout> </android.support.v4.widget.DrawerLayout> 谢谢

垂直DrawerLayout或SlidingPaneLayout

最新的Android支持库引入了DrawerLayout来实现常用UX模式,您可以向右或向左滑动以显示导航菜单。 我喜欢的是具有相同API的垂直DrawerLayout ,可以从布局的顶部/底部拉下/拉起。 由于4.2旧的SlidingDrawer已被弃用,我还没有听说过一些新的Widget实现相同的function。 DrawerLayout可以以某种方式扩展来实现垂直刷卡用户体验模式吗? 谷歌是否提供了一些不同的部件来实现它? 例如, Google音乐有一些类似于我要实现的function来拉动播放器。

Android:我如何让DrawerLayout将触摸事件传递给底层视图

我在我的应用程序中使用支持库的DrawerLayout 。 我注意到,当我点击我的Drawer视图中的一个空白区域时,底层的View(包含一个ListView )接收到Touch事件并对它做出反应。 onInterceptTouchEvent方法如下所示: @Override public boolean onInterceptTouchEvent(MotionEvent ev) { final int action = MotionEventCompat.getActionMasked(ev); // "|" used deliberately here; both methods should be invoked. final boolean interceptForDrag = mLeftDragger.shouldInterceptTouchEvent(ev) | mRightDragger.shouldInterceptTouchEvent(ev); boolean interceptForTap = false; switch (action) { case MotionEvent.ACTION_DOWN: { final float x = ev.getX(); final float y = ev.getY(); mInitialMotionX = […]

在DrawerLayout上禁用手势监听器

我如何禁用DrawerLayout的手势识别? (从左向右滑动),只接受closures手势(从右向左),并使用主屏幕button打开抽屉?

如何在NavigationView中自定义项目背景和项目文本颜色?

我想实现这样的材料devise文档中显示的东西。 colorControlHighlight用于检查项目的背景。 我需要自定义: 背景未选中 文字颜色检查 文本颜色未选中

方法setDrawerListener已弃用

当我在应用程序上做某些事情时,我发现应用程序上的导航抽屉缩小了其大小。 但是我没有做任何事情。 然后,在检查代码后,我看到setDrawerListener已被弃用。 有没有人有这个解决scheme? 任何帮助都可以做到。 先谢谢你! drawerLayout.setDrawerListener(actionBarDrawerToggle);