[英]Expandablelistview custom groupview to high
我有带有自定义UI的Expandablelistview。 我定义了从BaseExpandableListAdapter扩展的适配器。 我希望群组视图的高度恰好是25dp,但它们应该更高
我的xml是
<TextView
android:id="@+id/product_name"
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_weight="2"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:text="@string/products"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_marginLeft="25dp"
android:layout_weight="1"
android:gravity="center"
android:text="@string/weight_g"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_weight="1.6"
android:gravity="center"
android:text="@string/measure"
android:textSize="12sp"
android:textStyle="bold" />
`
和我的代码
@Override
public View getGroupView(final int groupPosition,
final boolean isExpanded, final View convertView,
final ViewGroup parent) {
final View view = View.inflate(context,
R.layout.header_measurements, null);
final TextView title = (TextView) view
.findViewById(R.id.product_name);
title.setText(data.get(groupPosition).categoryName);
return view;
}
您忽略了最重要的部分。 xml中的textview的容器(LinearLayout或RelativeLayout等)怎么说? 布局高度应为android:layout_height="25dp"
或android:layout_height="wrap_content"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.