[英]Change rowHight in Listpreference
Is it possible to change the Listpreference row height? 是否可以更改Listpreference行的高度? I managed to increase the textSize but it won't change the rowHeight. 我设法增加了textSize,但它不会改变rowHeight。
Cheers! 干杯!
Yes it is possible . 对的,这是可能的 。 Use LayoutParams for setting the height of the particular listView item inside the getView() method of your adapter which you are binding with your ListView. 使用LayoutParams可以在与ListView绑定的适配器的getView()方法内设置特定listView项目的高度。 Sample: 样品:
@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;
}
Here rel is a particular row in the listView. rel是listView中的特定行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.