android intent使用定義標(biāo)題
更新時(shí)間:2012年11月23日 15:38:22 作者:
本文將詳細(xì)介紹android怎樣自定義Intent選擇界面的標(biāo)題,提供相關(guān)參考方法
可以使用 Intent.createChooser() 的方法來創(chuàng)建 Intent,并傳入想要的 Sting 作為標(biāo)題。
以wallpaper 選擇框?yàn)槔?,?dāng)在Launcher workspace的空白區(qū)域上長按,會彈出wallpaper的選擇框,選擇框的標(biāo)題為”Choose wallpaper from”,如下:
private void startWallpaper() {
showWorkspace(true);
final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
Intent chooser = Intent.createChooser(pickWallpaper, getText(R.string.chooser_wallpaper));
// NOTE: Adds a configure option to the chooser if the wallpaper supports it
startActivityForResult(chooser, REQUEST_PICK_WALLPAPER);
}
其中,R.string.chooser_wallpaper對應(yīng)的字串內(nèi)容就是”Choose wallpaper from”,定義在Launcher2的Strings.xml中
以wallpaper 選擇框?yàn)槔?,?dāng)在Launcher workspace的空白區(qū)域上長按,會彈出wallpaper的選擇框,選擇框的標(biāo)題為”Choose wallpaper from”,如下:
復(fù)制代碼 代碼如下:
private void startWallpaper() {
showWorkspace(true);
final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
Intent chooser = Intent.createChooser(pickWallpaper, getText(R.string.chooser_wallpaper));
// NOTE: Adds a configure option to the chooser if the wallpaper supports it
startActivityForResult(chooser, REQUEST_PICK_WALLPAPER);
}
其中,R.string.chooser_wallpaper對應(yīng)的字串內(nèi)容就是”Choose wallpaper from”,定義在Launcher2的Strings.xml中
您可能感興趣的文章:
- Android 廣播大全 Intent Action 事件詳解
- android教程之intent的action屬性使用示例(intent發(fā)短信)
- android中Intent傳值與Bundle傳值的區(qū)別詳解
- Android Intent的幾種用法詳細(xì)解析
- android中intent傳遞list或者對象的方法
- Android組件間通信--深入理解Intent與IntentFilter
- Android Intent啟動別的應(yīng)用實(shí)現(xiàn)方法
- Android利用Intent啟動和關(guān)閉Activity
- Android開發(fā)之利用Intent實(shí)現(xiàn)數(shù)據(jù)傳遞的方法
- Android常用的intent action匯總
相關(guān)文章
分析Android 11.0Settings源碼之主界面加載
這篇文章主要介紹了分析Android 11.0Settings源碼之主界面加載,對Android源碼感興趣的同學(xué),可以著重看一下2021-04-04
Android編程布局控件之AbsoluteLayout用法實(shí)例分析
這篇文章主要介紹了Android編程布局控件之AbsoluteLayout用法,結(jié)合實(shí)例形式簡單分析了Android絕對布局AbsoluteLayout的使用技巧,需要的朋友可以參考下2015-12-12
Android Studio error: Unable to start the daemon process的解決方
這篇文章主要介紹了在 Android Studio 上新建項(xiàng)目,出現(xiàn) Unable to start the daemon process問題的幾種的解決方法,需要的朋友可以參考下2020-10-10
Android UI設(shè)計(jì)系列之HTML標(biāo)簽實(shí)現(xiàn)TextView設(shè)置中文字體加粗效果(6)
這篇文章主要介紹了Android UI設(shè)計(jì)系列之使用HTML標(biāo)簽,實(shí)現(xiàn)在TextView中對中文字體加粗的效果,具有一定的實(shí)用性和參考價(jià)值,感興趣的小伙伴們可以參考一下2016-06-06
基于Android實(shí)現(xiàn)跳轉(zhuǎn)到WiFi開關(guān)設(shè)置頁的詳細(xì)步驟
在Android應(yīng)用開發(fā)中,有時(shí)候需要引導(dǎo)用戶到特定的系統(tǒng)設(shè)置頁面,例如Wi-Fi開關(guān)設(shè)置頁,可以通過隱式Intent來實(shí)現(xiàn)這一功能,以下是詳細(xì)的步驟以及相關(guān)的Kotlin代碼示例,需要的朋友可以參考下2024-09-09
詳解升級Android Studio3.0時(shí)遇到的幾個(gè)問題
本篇文章主要介紹了升級Android Studio3.0時(shí)遇到的幾個(gè)問題,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-10-10
Android編程四大組件之Activity用法實(shí)例分析
這篇文章主要介紹了Android編程四大組件之Activity用法,實(shí)例分析了Activity的創(chuàng)建,生命周期,內(nèi)存管理及啟動模式等,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2016-01-01

