android抽屉效果错误,的Android导航抽屉布局引发错误

抽屉布局使用了两个相对布局,引发错误为:的Android导航抽屉布局引发错误

xml文件:

android:id="@+id/drawer_layout"

android:layout_width="match_parent"

android:layout_height="match_parent" >

android:id="@+id/relative_layout"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_gravity="start" >

android:id="@+id/list_slidermenu"

android:layout_width="197.50dp"

android:layout_height="fill_parent"

android:layout_gravity="start"

android:background="#2f2f2f"

android:choiceMode="singleChoice"

android:divider="@drawable/divider"

android:dividerHeight="0.5dp"

android:groupIndicator="@android:color/transparent"

android:listSelector="#2FB3E3" />

android:id="@+id/layout"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true" >

android:id="@+id/build"

style="?android:textAppearanceMedium"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:gravity="center"

android:paddingBottom="10dp"

android:paddingRight="100dp"

android:text="My View"

android:textColor="#FFFFFF" />

9月2日至18日:22:53.649:E/AndroidRuntime (30768): java.lang.ClassCastException: android.widget.RelativeLayout $的LayoutParams不能转换到 android.support.v4.widget.DrawerLayout $的LayoutParams

public boolean onPrepareOptionsMenu(Menu menu) {

// if nav drawer is opened, hide the action items

boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);

if() {

--------

} else {

--------

}

return super.onPrepareOptionsMenu(menu);

}

它throwa误差作为 “的InvocationTargetException” 行是

布尔drawerOpen = mDrawerlayout

+0

其进口错误,请使用正确的进口。 –

+0

现在一次检查是否也粘贴了xml代码,请问是什么样的正确导入 –

+0

看到,你试着把'RelativeLayout'的布局参数设置为'DrawerLayout'在你的代码的某个地方这样纠正这个 –

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值