繁体   English   中英

在Listpreference中更改rowHight

[英]Change rowHight in Listpreference

是否可以更改Listpreference行的高度? 我设法增加了textSize,但它不会改变rowHeight。

干杯!

对的,这是可能的 。 使用LayoutParams可以在与ListView绑定的适配器的getView()方法内设置特定listView项目的高度。 样品:

@Override
public View getView(final int position, View convertView,
        final ViewGroup parent) {

    RelativeLayout rel = null;
    if (null == convertView) {

        String inflater = Context.LAYOUT_INFLATER_SERVICE;
        LayoutInflater vi;
        vi = (LayoutInflater) getContext().getSystemService(inflater);
        rel = (RelativeLayout) vi.inflate(resource, rel, true);

    } else {
        rel = (RelativeLayout) convertView;

    }
               LayoutParams params= (LayoutParams) rel.getLayoutParams();
         params.height=///some height;
                 rel.setLayoutParams(params);

         return rel;
}

rel是listView中的特定行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM