标签:android style c class blog code
gridview中设置item的高度。
一、BaseAdapter中的getView中设置
AbsListView.LayoutParams param = new AbsListView.LayoutParams( android.view.ViewGroup.LayoutParams.MATCH_PARENT, parent.getWidth()/2+DpPx.dip2px(context,20));//-20 10spacing 5padding + 40 textview.height convertView.setLayoutParams(param);
二、dp转px
public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); }
Android 常见问题收集 (持续更新),布布扣,bubuko.com
标签:android style c class blog code
原文地址:http://www.cnblogs.com/beenupper/p/3735995.html