如何在Android中诊断(ScrollView中的RadioGroup)
我想在 ScrollView 中放置一个工作 RadioGroup。
这个 main.xml
导致应用程序在加载时崩溃...“抱歉!应用程序...已意外停止。请重试。强制关闭”
<ScrollView>
<RadioGroup android:id="@+id/types">
...
这有效
<ScrollView>
<RadioGroup android:id="@+id/types" android:layout_width="wrap_content" android:layout_height="wrap_content">
....
但我的问题是如何解决这个问题?(除了 尝试我在互联网上找到的随机代码)。在强制关闭时,堆栈跟踪似乎只是一堆启动器内容,并且从不提到我的main.xml
(在带有 AVD 的 Eclipse 中使用调试模式)。 某处是否有错误消息表明缺少这些属性?
I wanted to place a working RadioGroup inside a ScrollView.
This main.xml
caused the app to blow up on load... "Sorry! The application... has stopped unexpectedly. Please try again. Force close"
<ScrollView>
<RadioGroup android:id="@+id/types">
...
And this worked
<ScrollView>
<RadioGroup android:id="@+id/types" android:layout_width="wrap_content" android:layout_height="wrap_content">
....
My question, though, is how to figure this out? (aside from trying out random code I find on the Internet). On the force close, the stack trace seems to just be a bunch of launcher stuff, and never mentions my main.xml
(using Debug mode in Eclipse with an AVD). Is there an error message somewhere that says that these attributes are missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如何调试
看到与此类似的错误
您应该在 logcat 系统调试输出。
要求
宽度和高度始终是必需的。在“声明布局”中的布局参数部分< /a> 官方开发指南,它说
同样在“布局资源”开发指南中,它是声明 View 的所有子类都需要这两个属性
How to Debug
You should see an error similar to this
in the logcat system debug output.
Requirements
Width and height are always required. In the Layout Parameters section in the "Declaring Layout" official Dev Guide, it says
Also in the "Layout Resource" Dev Guide, it is stated that all subclasses of View require these two attributes
您所需要做的就是使用调试模式)当系统抛出异常时,它会出现在 LogCat 中,您可以在那里找到问题的详细信息。在您的情况下,您会得到类似的内容:
Everything you need is to use Debug mode) When system throws an exception it appears in LogCat and you can find details of issue there. In your case you will get something like that: