I have Expandablelistview with custom UI. I defined adapter extended from BaseExpandableListAdapter. I want my groupviews to be exactly 25dp height, but they are higher
my xml is `
<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" />
`
and my code
@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;
}
you left out the most important part. what does the container (LinearLayout or RelativeLayout, etc) of your textviews in the xml say? the layout height should either say android:layout_height="25dp"
or android:layout_height="wrap_content"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.