出现问题的布局控件
<ExpandableListView
android:id="@+id/groupList"
android:layout_width="150dip"
android:layout_height="fill_parent"
android:layout_above="@+id/group_layout"
android:scrollbars="none"/>
在使用ExpandableListView控件时,发现当点击列表按钮时,会刷新8次数据,通过网上资料有说ListView,getView多次刷新设置layout_height为fill_parent即可,但我的布局本身就是fill_parent。找关于 ExpandableListView 多次刷新的资料,找不到,就试着修改关于fill_parent类型的属性,修改layout_width="fill_parent",多次刷新就不在了。先附上不会多次刷新的布局
修改后的布局控件
<ExpandableListViewandroid:id="@+id/groupList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/group_layout"
android:scrollbars="none"/>
由于贴图已经实现分割线效果,现要隐藏掉ExpandableListView分割线,直接设置android:dividerHeight="0dip",显示界面发现,默认的分割线还在,后经过多次尝试,终于去掉了默认分割线,属性设置如下:
<ExpandableListView
android:id="@+id/groupList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:childDivider="@null"
android:divider="@null"
android:dividerHeight="0dip"
android:scrollbars="none" />