在ListVIew的美化过程中遇到的问题:ListView Item高度设置,本来想通过

android:minHeight="?android:attr/listPreferredItemHeightLarge"

来设置高度,实际试了一下发现不行,但是ListVIew的padding和margin设置的都是整体的,而不是局部的item项,

解决方法:通过调整LayoutInflater填充的子Layout来实现效果,

注意:子Layout中用LinearLayout,再用

android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"

才有上下空出一片的效果,而如果用RelativeLayout的话,

android:layout_marginBottom="10dp"

将无效,导致上下不均匀。

附上一张效果图

关于自定义LIstView的每项item的宽高设置

相关文章:

  • 2021-12-22
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2021-12-25
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2021-12-06
  • 2022-12-23
相关资源
相似解决方案