當前位置:編程學習大全網 - 網站源碼 - eclipse如何從頁面跳轉?

eclipse如何從頁面跳轉?

Eclipse使用intent語句從壹個頁面跳到另壹個頁面:

例如:從第壹個活動跳轉到第二個活動的代碼:

如果FristActivity和SecondActivity對應的UI是FristAty.xml和SecondAty.xml,則有:

(1)在FristActivity.xml中添加壹個按鈕

(2)用FristActivity編寫以下主要代碼:

公開課活躍拓展活動{

Button BTN =(Button)findViewById(r . id . Button);

btn.setOnClickListener(新視圖。OnClickListener() {

@覆蓋

公共void onClick(視圖視圖){

Intent Intent = new Intent(frist activity . this,second activity . class);

startActivity(意圖);

}

});

}

  • 上一篇:請教:如何在Linux下獲得EDID信息
  • 下一篇:自動駕駛的四大關鍵技術
  • copyright 2024編程學習大全網