SlidingDrawer ID引发的错误 ava.lang.IllegalArgumentException: The handle attribute is must refer to a
来源:互联网 发布:协议数据单元组成 编辑:程序博客网 时间:2024/05/22 13:22
在xml文件中定义如下:
01
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
02
<
LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
03
android:orientation
=
"vertical"
04
android:layout_width
=
"fill_parent"
05
android:layout_height
=
"fill_parent"
06
>
07
<
SlidingDrawer
08
android:layout_width
=
"fill_parent"
09
android:layout_height
=
"fill_parent"
10
android:id
=
"@+id/sliding"
11
android:handle
=
"@+id/name"
12
android:content
=
"@+id/layout"
13
/>
14
<
ImageView
15
android:id
=
"@+id/name"
16
android:src
=
"@drawable/icon"
17
android:layout_width
=
"wrap_content"
18
android:layout_height
=
"wrap_content"
19
/>
20
<
LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
21
android:orientation
=
"vertical"
22
android:id
=
"@+id/layout"
23
android:layout_width
=
"fill_parent"
24
android:layout_height
=
"fill_parent"
25
>
26
27
</
LinearLayout
>
Activity没做任何修改,运行后出现错误:
02-28 14:18:55.887: ERROR/AndroidRuntime(354): java.lang.RuntimeException: Unable to start activity ComponentInfo{yang.slidingdrawer03/yang.slidingdrawer03.SlidignDrawer03}: java.lang.IllegalArgumentException: The handle attribute is must refer to an existing child.
哪位大神帮看看呀!
按评价排序 |显示最新答案 | 回页面顶部共有6个答案我要回答»
- 迷途d书童 回答于 2012-02-29 10:42举报上面布局文件少了一个
LinearLayout的结束标签
有帮助(0) |没帮助(0) |评论(0) |引用此答案 - 叶的旺旺 回答于 2012-02-29 11:52举报
不好意思,发漏了,完整代码是这样的,:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<SlidingDrawer
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/sliding"
android:handle="@+id/name"
android:content="@+id/layout"
/>
<ImageView
android:id="@+id/name"
android:src="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout></LinearLayout>
还是出现上面的错误,Activity没做修改有帮助(0) |没帮助(0) |评论(0) |引用此答案 - 迷途d书童 回答于 2012-02-29 12:03举报
01
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
02
<
LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
03
android:orientation
=
"vertical"
04
android:layout_width
=
"fill_parent"
05
android:layout_height
=
"fill_parent"
06
>
07
<
SlidingDrawer
08
android:layout_width
=
"fill_parent"
09
android:layout_height
=
"fill_parent"
10
android:id
=
"@+id/sliding"
11
android:handle
=
"@+id/name"
12
android:content
=
"@+id/layout"
13
/>
14
<
ImageView
15
android:id
=
"@id/name"
16
android:src
=
"@drawable/icon"
17
android:layout_width
=
"wrap_content"
18
android:layout_height
=
"wrap_content"
19
/>
20
<
LinearLayout
21
android:orientation
=
"vertical"
22
android:id
=
"@id/layout"
23
android:layout_width
=
"fill_parent"
24
android:layout_height
=
"fill_parent"
25
>
26
</
LinearLayout
>
27
</
SlidingDrawer
>
28
</
LinearLayout
>
ImageView,LinearLayout是SlidingDrawer子控件,引用SlidingDrawer的android:handle,android:content的id。
有帮助(0) |没帮助(0) |评论(0) |引用此答案 - 叶的旺旺 回答于 2012-02-29 12:16举报
奇怪的是,我写另一个布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<SlidingDrawer
android:id="@+id/sd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:handle="@+id/name"
android:content="@+id/content"
>
<Button
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
</SlidingDrawer>
</LinearLayout>却正常运行
--- 共有 1 条评论 ---- 你对比下我上面贴的代码,ImageView和LinearLayout是不是包含在SlidingDrawer里面。(7个月前 by 迷途d书童)
有帮助(0) |没帮助(0) |评论(1) |引用此答案 - 叶的旺旺 回答于 2012-02-29 12:38举报已检查出来,第一个SlidingDrawer中,应该是<SlidingDrawer > 而不是<SlidingDrawer/>有帮助(0) |没帮助(0) |评论(0) |引用此答案
- 雨焰 回答于 2012-04-04 14:41举报
你多写了一个命名空间-xmlns
在你的第二个linearlayout中不用再写xmlns!
- SlidingDrawer ID引发的错误 ava.lang.IllegalArgumentException: The handle attribute is must refer to a
- SlidingDrawer引发java.lang.IllegalArgumentException: The content attribute is must refer to an existin
- Caused by: java.lang.IllegalArgumentException: The handle attribute is must refer to an existing chi
- 错误java.lang.IllegalArgumentException: id to load is required for loading的解决方法
- Android中 Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法
- Android Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法
- Android中 Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法
- Android Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法
- 错误处理:your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
- 错误处理:your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
- Caused by: java.lang.IllegalArgumentException: you must specify a way to create the tab indicator.
- java.lang.IllegalArgumentException: you must specify a way to create the tab content
- java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.li
- java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.ta
- Android—Android中 Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法
- Android: Your content must have a TabHost whose id attribute is ‘android.R.id.tabhost’ 错误分析及解决方法
- 错误 java.lang.IllegalArgumentException: parameter must be a descendant of this view 的解决方案
- 错误 java.lang.IllegalArgumentException: parameter must be a descendant of this view 的解决方案
- commons-lang(time应用)
- 云南红河称官员被举报诱奸女网友事件查无证据-诱奸-官员丑闻-官员不正之风
- android JNI 调用第三方动态库
- 《算法设计》求单峰数组
- 【转】XML节点的认识
- SlidingDrawer ID引发的错误 ava.lang.IllegalArgumentException: The handle attribute is must refer to a
- SSL握手1
- WPA/RSN四次握手和PTK
- 海词网:在线教育平台
- Node.js零起点开发(一)-NodeJs安装、Hello Word
- JAVA多线程实现和应用总结
- SSL握手2
- 3Filter应用2禁止浏览器缓存所有动态页面的过滤器
- Centos上安卓开发环境的安装