當前位置:首頁 » 安卓系統 » android設置界面跳轉

android設置界面跳轉

發布時間: 2025-03-28 13:23:20

⑴ android中如何設置點擊button頁面跳轉

java">btn_save.setOnClickListener(newView.OnClickListener()
{
@Override
publicvoidonClick(Viewview)
{
Intentintent=newIntent(當前的Activity.this,要跳轉的Activity.class);
startActivity(intent);
}
});

其中btn_save就是button按鈕

⑵ 如何指定Android中的瀏覽器跳轉界面

一、啟動android默認瀏覽器

在Android程序中我們可以通過發送隱式Intent來啟動系統默認的瀏覽器。如果手機本身安裝了多個瀏覽器而又沒有設置默認瀏覽器的話,系統將讓用戶選擇使用哪個瀏覽器來打開連接。關於Intent的更多內容請參考《常用Intent》

示例1

Intent intent =newIntent();

        intent.setAction("android.intent.action.VIEW");

        Uri content_url =Uri.parse("http://www.163.com");

        intent.setData(content_url);

        startActivity(intent);

這樣子,android就可以調用起手機默認的瀏覽器訪問

二、啟動指定瀏覽器

在Android程序中我們可以通過發送顯式Intent來啟動指定的瀏覽器。

啟動Android原生瀏覽器

示例2

Intent intent =newIntent();       

        intent.setAction("android.intent.action.VIEW");   

        Uri content_url =Uri.parse("http://www.163.com"); 

        intent.setData(content_url);         

        intent.setClassName("com.android.browser","com.android.browser.BrowserActivity"); 

        startActivity(intent);

只要修改以intent.setClassName("com.android.browser","com.android.browser.BrowserActivity");

中相應的應用程序packagename 和要啟動的activity即可啟動其他瀏覽器來

uc瀏覽器":"com.uc.browser", "com.uc.browser.ActivityUpdate「

opera瀏覽器:"com.opera.mini.android", "com.opera.mini.android.Browser"

qq瀏覽器:"com.tencent.mtt", "com.tencent.mtt.MainActivity"

⑶ Android開發 單擊按鈕實現頁面跳轉

在.java文件中
//-新建Intent對象
Intent intent = new Intent();
//-指定傳遞對象,mainActivity為傳遞對象,Activity2為被傳遞對象intent.setClass(mainActivity.this,Activity2.class);
//-將Intent傳遞給Activity
startActivity(intent);
//-結束當前Activity
mainActivity.this.finish();

在AndroidManifest.xml文件中
<activity
android:name=".Activity2" >
</activity>
註:Activity2為要跳轉的頁面

在mainActivity中用setContentView(R.layout.main);與第一個界面相關聯(main.xml為第一個界面)

在Activity2中用setContentView(R.layout.main2);與要跳轉的那個界面關聯起來(main.xml為要跳轉過去的那個界面)

熱點內容
汽車上的藍牙密碼是什麼 發布:2025-04-30 14:09:19 瀏覽:75
陰陽師淘手游安卓官方是什麼平台 發布:2025-04-30 14:08:20 瀏覽:39
哪裡可以買密碼盒子 發布:2025-04-30 13:52:18 瀏覽:602
原子操作linux 發布:2025-04-30 13:48:05 瀏覽:758
androidlistview選中項 發布:2025-04-30 13:21:19 瀏覽:100
置換演算法代碼 發布:2025-04-30 13:11:03 瀏覽:865
怎麼清除小米鎖屏密碼 發布:2025-04-30 13:01:23 瀏覽:78
php裝修門戶系統 發布:2025-04-30 13:01:19 瀏覽:263
配置管理包含哪些審核 發布:2025-04-30 12:57:33 瀏覽:64
3dnand存儲器 發布:2025-04-30 12:56:58 瀏覽:132