本文介绍了自定义列表适配器惯于显示图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编辑:我打消了我的异常信息。随着@Sam的帮助,我能够使用修复项目属性,应用程序不再强迫我关闭。虽然,从图像的TextView重新安排布局TextView的形象使其不能显示图像。没有人有任何想法,为什么?所有code可以在这里
BEFORE
<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" />
AFTER
<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" />
解决方案
This makes no sense!
- Try cleaning your project: Project -> Clean...
- Or use Fix Properties from Android Tools
Also your ImageView and TextView are sitting on top of each other, you might want to add android:layout_width="wrap_content"
and android:layout_weight="5"
to the TextView and android:layout_weight="1"
to the ImageView. ... :)
这篇关于自定义列表适配器惯于显示图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!