Re: [問題] SimpleAdapter 與 ListView
main.xml:
<LinearLayout
<TextView android:id="@+id/textView" />
<ListView android:id="@+id/listView"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
activity.java:
.....
setContentView(R.layout.main);
ListView list=(ListView)findViewById(R.id.ListView01);
//抓取 LietView 的值
....
印象中是醬
可以參考以下網頁:
http://ppt.cc/1XoB
http://ppt.cc/YoPy
※ 引述《jakevin (真。假凱文)》之銘言:
: 我想要做的只是
: 歡迎使用本軟體 (TextView)
: (以下為ListView)
: 選項一(ListView)
: 台視 (Sub Item)
: 選項二(ListView)
: 中視 (Sub Item)
: 選項三(ListView)
: 華視 (Sub Item)
: 選項四(ListView)
: 公視 (Sub Item)
: 我在 Layout 是這樣佈置
: <LinearLayout
: <TextView android:id="@+id/textView" />
: </LinearLayout>
: 然後語法是用 ListActivity + SimpleAdapter
: //新增SimpleAdapter
: adapter = new SimpleAdapter(
: this,
: list,
: android.R.layout.simple_list_item_2,
: new String[] { "option","tv" },
: new int[] {android.R.id.text1, android.R.id.text2} );
: 只是在 onCreate 下
: 加了 setContentView(R.layout.main); 就會錯誤
: 不加就可以正常執行
: 想請問 只是要多一個 TextView 的話
: 怎樣做才是最好的方式呢?
: 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.66.168.3
討論串 (同標題文章)