How to set custom list view item's height…?

六月ゝ 毕业季﹏ 提交于 2019-12-05 15:45:41
harish

convertedview.setlayoutparams(new Listview.setlayoutparams(width, height));

First put LinearLayout instead of ListView

and then edit that to ListView otherwise it will not work. This is the trick.

set minHeight in R.layout.type10_sub elements

Its very easy to hardcode in a new height for the custom view simply specify the layout_height for the highest level item, in this case the LinearLayout. Below I've shown how to set it to 100dp

<?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="100dp">

    ....
</LinearLayout> 

In linear layout give android:layout_height="100dp" instead of wrap_content

use:

if(convertView == null){
    convertView = inflater.inflate(R.layout.type10_sub, parent);   
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!