課程
/移動開發(fā)
/Android
/Android攻城獅的第二門課(第1季)
?監(jiān)聽事件能使每個圖片點擊后實現不同的activity的跳轉嗎
2015-05-15
源自:Android攻城獅的第二門課(第1季) 4-4
正在回答
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(this, iconName[position], Toast.LENGTH_SHORT).show();
switch (position) {
case 0:
Intent intent=new Intent(this,P0.class);
startActivity(intent);
break;
case 1:
Intent intent=new Intent(this,P1.class);
case 2:
Intent intent=new Intent(this,P2.class);
……
}
就是這個樣子,在老師教的下面添加Intent,用switch (position)來確定選擇的是哪個,然后跳轉到需要的界面。
Lcc001
當然可以了,但是記得要在manifest文件里面去定義每一個avtivity
試用intent進行跳轉
of course
舉報
本課程由淺入深地帶您學會Android的常用控件的開發(fā)和使用
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優(yōu)惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-01-25
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(this, iconName[position], Toast.LENGTH_SHORT).show();
switch (position) {
case 0:
Intent intent=new Intent(this,P0.class);
startActivity(intent);
break;
case 1:
Intent intent=new Intent(this,P1.class);
startActivity(intent);
break;
case 2:
Intent intent=new Intent(this,P2.class);
startActivity(intent);
break;
……
}
就是這個樣子,在老師教的下面添加Intent,用switch (position)來確定選擇的是哪個,然后跳轉到需要的界面。
2015-12-31
當然可以了,但是記得要在manifest文件里面去定義每一個avtivity
2015-08-16
試用intent進行跳轉
2015-05-16
of course