最近一直纠结于ListView中每个Item中高度的问题,在网上只找出一个方法,就是在每个item里面加入图片,也就是ImageView,这样用图片来“撑”它的高度,这样实在是费劲,不可也可以解决问题
今天无意间看SDK里面的Demo,发现还有一种方法,如下黑色粗体所示
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="?android:attr/listPreferredItemHeight"
>
<TextView
android:id="@+id/tv"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:text="@string/hello"
/>
</LinearLayout>
本文探讨了在Android开发中ListView中每个Item高度调整的方法,包括使用ImageView填充高度及通过XML布局实现高度自适应,提供了两种不同的解决方案。
639

被折叠的 条评论
为什么被折叠?



