写真とサマリー(アイテムリストのテキストの下にあるテキスト)を使ってリストを作成するには、どのようにアイテムを説明するのが難しいのですか?サマリーでリストの活動を作ろう
私のコードは画像とともにリストを作成します。サマリーを追加するにはどうしたらいいですか?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/icon"
android:layout_width="22px"
android:layout_height="22px"
android:layout_marginLeft="4px"
android:layout_marginRight="10px"
android:layout_marginTop="4px"
android:src="@drawable/ic_launcher" >
</ImageView>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/label"
android:textSize="20px" >
</TextView>
</LinearLayout>
Activityクラス:
public class MyListActivity extends ListActivity {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
"Linux", "OS/2" };
// Use your own layout
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.rowlayout, R.id.label, values);
setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
String item = (String) getListAdapter().getItem(position);
Toast.makeText(this, item + " selected", Toast.LENGTH_LONG).show();
}
}
私は自分のコードにとどまっているので、要約の方法は何か教えてください。ありがとうございます – user1257040
要約の方法?それはどういう意味ですか?あなたの問題に適応したいなら、MyListActivityでxmlとほぼ同じコードを使うことができます。アダプターとgetView(int position、View convertView、ViewGroup parent)を作成するだけです。私はそれで私の答えを完了しようとします。 –
要約=項目の下に小さな説明があり、別のテキスト表示に似ています。 – user1257040