我使用SlidingPaneLayout制作自定义抽屉菜单,我需要禁用可拖动的事件,通过单击工具栏导航按钮,只显示我的服装抽屉,activity_main的结构是:
主活性
<android.support.v4.widget.SlidingPaneLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/slidingPaneLayout"
android:clickable="false"
android:scrollbarAlwaysDrawHorizontalTrack="false"
tools:context=".MainActivity.MainActivity">
<!--Costume Drawer fragment-->
<fragment
android:name="com.epcon.pdhgto.android.MenuFragment.MenuFragment"
android:layout_width="80dp"
android:layout_height="match_parent"
android:id="@+id/menu_master"
android:elevation="10dp">
</fragment>
<!--Fragment-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:id="@+id/mainFrameLayout"
>
</FrameLayout>
</android.support.v4.widget.SlidingPaneLayout>换句话说,我需要禁用我的主要活动的水平滚动。我已经尝试过了:https://stackoverflow.com/a/36447209/6308377和我也在xml上实现了,但是这是行不通的。
发布于 2018-10-12 17:07:51
在你的活动中试试这个
view.setHorizontalScrollBarEnabled(false);或者将其放入xml文件中。
android:scrollbars="none"此外,如果您想为您的应用程序定制菜单,您应该查看导航抽屉。
https://stackoverflow.com/questions/52783021
复制相似问题