首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置SlidingPaneLayout水平滚动禁用

设置SlidingPaneLayout水平滚动禁用
EN

Stack Overflow用户
提问于 2018-10-12 15:51:14
回答 1查看 82关注 0票数 0

我使用SlidingPaneLayout制作自定义抽屉菜单,我需要禁用可拖动的事件,通过单击工具栏导航按钮,只显示我的服装抽屉,activity_main的结构是:

主活性

代码语言:javascript
复制
<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上实现了,但是这是行不通的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-12 17:07:51

在你的活动中试试这个

代码语言:javascript
复制
view.setHorizontalScrollBarEnabled(false);

或者将其放入xml文件中。

代码语言:javascript
复制
android:scrollbars="none"

此外,如果您想为您的应用程序定制菜单,您应该查看导航抽屉。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52783021

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档