我有一个屏幕布局,上面有一个东西列表:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<include android:id="@+id/header"
layout="@layout/header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
<TextView
android:id="@+id/loading_questions"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Text for please wait while questions load. If the questions do not load, check your Internet connection. Questions are stored in a secure remote database so that you do not lose your work."
android:textSize="12sp"
/>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ListView>
</LinearLayout>
在我的代码中,我像这样加载它:
ListView list = (ListView) findViewById(R.id.list);
然后像这样填充它:
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
// My data
private List<HashMap<String, String>> fillMaps = new ArrayList<HashMap<String, String>>();
SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.questions_list,
new String[] {"train", "to"},
new int[] {R.id.TRAIN_CELL, R.id.TO_CELL});
// This was the middle item R.id.FROM_CELL,
list.setAdapter(adapter);
list.setTextFilterEnabled(true);
然后当项目加载时,我只是重新填充这个适配器。
这是 questions_list.xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:textSize="13sp">
<TextView android:id="@+id/TRAIN_CELL"
android:layout_width="275dip"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/TO_CELL"
android:layout_width="25dip"
android:textSize="20sp"
android:textStyle="bold"
android:gravity="center"
android:src="@drawable/arrow_button"
android:textColor="@color/light_best_blue"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
它确实用两列呈现列表,但问题是它禁用了我的标题导航(按钮不再起作用),并且标题周围也有一个白色边框。
有谁知道为什么会发生这种情况以及如何解决它?
谢谢!