私のセルには次のXMLコードがあります(search_cell.xml):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingTop="3dp"
android:background="@color/white"
>
<TextView android:id="@+id/libelle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="16dp"
android:textStyle="bold"
/>
<TextView android:id="@+id/valeur"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="10dp"
android:textStyle="normal"
/>
</LinearLayout>
私のアクティビティxmlファイル:
<ListView
android:id="@+id/listRecherche"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="150dp" >
</ListView>
そしてJavaでは:
list =(ListView)findViewById(R.id.listRecherche);
ArrayList<HashMap<String, String>> listItem = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
map.put("libelle", "Microsoft");
map.put("valeur", "1975");
listItem.add(map);
map = new HashMap<String, String>();
map.put("libelle", "Apple");
map.put("valeur", "1976");
listItem.add(map);
map = new HashMap<String, String>();
map.put("libelle", "Dell");
map.put("valeur", "1984");
listItem.add(map);
SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.recherche_cell,
new String[] {"libelle", "valeur"}, new int[] {R.id.libelle, R.id.valeur});
list.setAdapter(mSchedule);
そして、これが私が得たものです。年のフィールドが表示されないのはなぜですか?
どうもありがとうございました。