0
我有一些問題試圖找出如何將操作添加到列表視圖中的所有項目。我的意思是我想在按下某個項目時做某些事情。現在,我按下了一個項目,但沒有任何操作。我希望它能做些什麼,那就是我需要幫助的地方。將行爲添加到ListView項目
這是我在MainActivity使用代碼:
public class MainActivity extends Activity {
private ListView listView1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViedoStream viedoStream_data[] = new ViedoStream[]
{
new ViedoStream(R.drawable.image0, "Mission TV"),
new ViedoStream(R.drawable.image1, "HCBN Philippines"),
new ViedoStream(R.drawable.image2, "Global Family Network"),
new ViedoStream(R.drawable.image3, "2CBN"),
new ViedoStream(R.drawable.image4, "Red ADvenir"),
new ViedoStream(R.drawable.image5, "Alfa Television"),
new ViedoStream(R.drawable.image6, "Light Channel Hungary"),
new ViedoStream(R.drawable.image7, "Light Channel Rumania"),
new ViedoStream(R.drawable.image8, "Light Channel Germany"),
new ViedoStream(R.drawable.image9, "Terceiro Anjo"),
new ViedoStream(R.drawable.image10, "HCBN Indonesia"),
new ViedoStream(R.drawable.image11, "TV Famille")
};
ViedoStreamAdapter adapter = new ViedoStreamAdapter(this,
R.layout.listview_item_row, viedoStream_data);
listView1 = (ListView)findViewById(R.id.listView1);
View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null);
listView1.addHeaderView(header);
listView1.setAdapter(adapter);
}
}什麼是按項目
,我想從一個HTTP流播放視頻流,但我有怎樣的想法執行此類操作。我只需要知道如何讓它做點什麼。
有人可以幫我這麼做嗎?順便提一下,我是Android平臺的新手。
感謝
什麼樣的動作? – mleczey 2013-04-28 16:49:49
編輯*再次閱讀我的文章。對不起......我不清楚。 – 2013-04-28 17:45:53
要執行操作,當按下項目時,應該設置監聽器。這裏是[參考](http://developer.android.com/reference/android/widget/AdapterView.html#setOnItemClickListener(android.widget.AdapterView.OnItemClickListener))的鏈接。 – mleczey 2013-04-28 19:15:45