簡體   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