安卓之使用DrawerLayout出现的java.lang.UnsupportedOperationException异常

在使用安卓的抽屉控件DrawerLayout的时候有这样的一个需求,就是在某些状态下抽屉上的布局是列表 left_drawer有些状态下是列表left_drawer1两个列表样式不一样。因此我的布局文件就写成这个样子如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffffff"
    android:orientation="vertical" >

  

    <android.support.v4.widget.DrawerLayout
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/tv_sidebar_tip"
                android:layout_width="@dimen/contacts_main_sidebar_tipbox_size"
                android:layout_height="@dimen/contacts_main_sidebar_tipbox_size"
                android:layout_gravity="center"
                android:background="#C1F1FD"
                android:gravity="center"
                android:textColor="@color/blue"
                android:textSize="@dimen/common_textsize_xxl"
                android:textStyle="bold"
                />
        </FrameLayout>

        <com.diegocarloslima.fgelv.lib.FloatingGroupExpandableListView
            android:id="@+id/left_drawer"
            android:layout_width="@dimen/contacts_main_drawer_width"
            android:layout_height="match_parent"
            android:layout_gravity="right"
            android:background="#ffffffff"
            android:cacheColorHint="@android:color/transparent"
            android:childDivider="#00000000"
            android:choiceMode="singleChoice"
            android:divider="#00000000"
            android:dividerHeight="1dp"
	    android:visibility="gone"
            android:scrollbars="@null" />
 	<ExpandableListView
            android:id="@+id/left_drawer1"
            android:layout_width="@dimen/contacts_main_drawer_width"
            android:layout_height="match_parent"
            android:layout_gravity="right"
            android:background="#ffffffff"
            android:cacheColorHint="@android:color/transparent"
            android:childDivider="#00000000"
            android:choiceMode="singleChoice"
            android:divider="#00000000"
            android:dividerHeight="1dp"
            android:scrollbars="@null"
            android:visibility="gone" >
    </android.support.v4.widget.DrawerLayout>

</LinearLayout>


然后在代码中控制两个列表的显示和隐藏。结果在隐藏left_drawer显示left_drawer1的时候,加载显示都是没问题的。但是在关闭抽屉却会报出标题上的那个异常问题。而一个列表是正常的。因此 我想导致这个错误应该是DrawerLayout的抽屉布局里面不支持两个列表导致。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值