【发布时间】:2012-11-11 22:18:17
【问题描述】:
编辑:我删除了我的异常信息。在@Sam 的帮助下,我能够使用修复项目属性并且应用程序不再强制关闭我。但是,将布局从 image textview 重新排列到 textview image 会导致它不显示图像。有谁知道为什么?所有代码都可以在这里找到http://www.ezzylearning.com/tutorial.aspx?tid=1763429
我正在尝试学习本教程 http://www.ezzylearning.com/tutorial.aspx?tid=1763429我有 一切都按照发布的方式工作。我正在采用这个更复杂的 布局。我试图改变一些非常简单的东西。我移动了图片 从左到右。
之前
<ImageView android:id="@+id/imgIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView android:id="@+id/txtTitle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:textStyle="bold"
android:textSize="22dp"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
之后
<TextView android:id="@+id/txtTitle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:textStyle="bold"
android:textSize="22dp"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<ImageView android:id="@+id/imgIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
【问题讨论】:
-
像这样重新排列 XML 不应使您的应用程序崩溃,但发生了其他事情。发布您的
getView()方法并将您的 LogCat 错误剪切并粘贴到问题中。 (你的截图不完整……) -
我的观点完全一致。它应该通过 ID 找到所有内容,那为什么会失败?我已经更新了所要求的信息。
-
@Sam 你是如何添加卷轴的?只是格式化为代码?
-
是的,突出显示文本并按 Ctrl+K(更容易阅读!)无论如何,这里的 XML 是您的 XML 的精确副本吗?我觉得 id 属性被交换了......
-
这毫无意义...尝试清理您的项目:Project -> Clean...
标签: android xml layout android-arrayadapter custom-lists