0
我有ExpandableListView
,CheckedTextView
作为grouprow View。但是我需要减少组间距,所以我把它放在LinearLayout
之内。该列表从此不再扩展,对点击没有任何反应。有任何想法吗?代码低于ExpandableListView - 组行不会对点击产生反应
grouprow.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/holder"
android:clickable="true"
android:orientation="vertical">
<CheckedTextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-13dp"
android:layout_marginBottom="-13dp"
android:text="@string/hello_world"
android:paddingLeft="20dp"
android:textColor="#FFFFFF"
android:textSize="60sp"
android:includeFontPadding="false"
android:textStyle="bold" />
</LinearLayout>
获得组视图:
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = minflater.inflate(R.layout.grouprow, null);
}
LinearLayout holder = (LinearLayout) convertView;
CheckedTextView txtGr = (CheckedTextView) holder.findViewById(R.id.textView1);
txtGr.setText(groupItem.get(groupPosition));
txtGr.setChecked(isExpanded);
font = Typeface.createFromAsset(activity.getAssets(),
"uww.otf");
txtGr.setTypeface(font);
return convertView;
}