[英]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.