我无法更改ExpandableListView
的初始状态,我希望它显示为"打开"起初。
答案 0 :(得分:0)
使用它可视化标记:
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
然后用它来改变初始状态
android:checked="true"
或者
mCheckedTextView.setChecked(true);
这是我的CheckedTextView:
<CheckedTextView
android:id="@+id/checkedTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="48dp"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:checked="true"
android:text="CheckedTextView" />
答案 1 :(得分:0)
从SimpleExpandableListAdapter扩展并覆盖getGroupView:
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
View view = super.getGroupView(groupPosition, isExpanded, convertView, parent);
ExpandableListView mExpandableListView = (ExpandableListView) parent;
mExpandableListView.expandGroup(groupPosition);
return view;
}