Android Studio:当ExpandableListView显示时,其他控件消失
我有一个包含3行的TableLayout:Android Studio:当ExpandableListView显示时,其他控件消失,android,expandablelistview,Android,Expandablelistview,我有一个包含3行的TableLayout: 第一行:标签 第二行:ARelativeLayout与2editText和A 按钮 第三行:一个ExpandableListView 我正在通过一个AsyncTask任务填写列表。它工作正常,列表显示记录,但是,当它显示时,第二行中的控件消失 就在我打电话之后: expListView.setAdapter(listAdapter); 这是我的布局 <TableLayout android:layout_width="match_p
- 第一行:标签
- 第二行:A
与2RelativeLayout
和AeditText
按钮
- 第三行:一个
ExpandableListView
AsyncTask
任务填写列表。它工作正常,列表显示记录,但是,当它显示时,第二行中的控件消失
就在我打电话之后:
expListView.setAdapter(listAdapter);
这是我的布局
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:weightSum="1">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Los 5 productos maś vendidos en la web"
android:id="@+id/textView2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dateFrom"
android:layout_weight="1"
android:enabled="true"
android:editable="false"
android:background="#d9fcff"
android:text="2015-10-01"
android:height="40dp"
android:layout_marginTop="5dp"
android:gravity="center_vertical|center_horizontal"
android:width="140dp"
android:layout_toStartOf="@+id/dateTo" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dateTo"
android:layout_weight="1"
android:enabled="true"
android:editable="false"
android:background="#eafccf"
android:text="2015-10-30"
android:height="40dp"
android:gravity="center_vertical|center_horizontal"
android:width="140dp"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="52dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"
android:id="@+id/button12"
android:width="30dp"
android:layout_weight="0.08"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<ExpandableListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/expandableListView"
android:layout_weight="1.04"
android:layout_marginTop="10dp" />
</TableRow>
</TableLayout>
其onPostExecute代码为:
activityStats.setProductsList(listDataHeader, listDataChild);
setProductsList方法是:
public void setProductsList(List<String> listDataHeader, HashMap<String, List<String>> listDataChild) {
listAdapter = new ExpandableListAdapter(getApplicationContext(), listDataHeader, listDataChild);
listAdapter.notifyDataSetChanged();
expListView.setAdapter(listAdapter);
}
public void setProductsList(列表listDataHeader,HashMap listDataChild){
listAdapter=新的ExpandableListAdapter(getApplicationContext(),listDataHeader,listDataChild);
listAdapter.notifyDataSetChanged();
expListView.setAdapter(listAdapter);
}
我想我们需要看到更多的代码/布局。在这里发布xml代码。理想情况下,应该使用lisview的标题将内容放在listview之上
public void setProductsList(List<String> listDataHeader, HashMap<String, List<String>> listDataChild) {
listAdapter = new ExpandableListAdapter(getApplicationContext(), listDataHeader, listDataChild);
listAdapter.notifyDataSetChanged();
expListView.setAdapter(listAdapter);
}