android intent使用定義標題
更新時間:2012年11月23日 15:38:22 作者:
本文將詳細介紹android怎樣自定義Intent選擇界面的標題,提供相關(guān)參考方法
可以使用 Intent.createChooser() 的方法來創(chuàng)建 Intent,并傳入想要的 Sting 作為標題。
以wallpaper 選擇框為例,當在Launcher workspace的空白區(qū)域上長按,會彈出wallpaper的選擇框,選擇框的標題為”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 選擇框為例,當在Launcher workspace的空白區(qū)域上長按,會彈出wallpaper的選擇框,選擇框的標題為”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的幾種用法詳細解析
- android中intent傳遞list或者對象的方法
- Android組件間通信--深入理解Intent與IntentFilter
- Android Intent啟動別的應(yīng)用實現(xiàn)方法
- Android利用Intent啟動和關(guān)閉Activity
- Android開發(fā)之利用Intent實現(xiàn)數(shù)據(jù)傳遞的方法
- Android常用的intent action匯總
相關(guān)文章
分析Android 11.0Settings源碼之主界面加載
這篇文章主要介紹了分析Android 11.0Settings源碼之主界面加載,對Android源碼感興趣的同學(xué),可以著重看一下2021-04-04
Android編程布局控件之AbsoluteLayout用法實例分析
這篇文章主要介紹了Android編程布局控件之AbsoluteLayout用法,結(jié)合實例形式簡單分析了Android絕對布局AbsoluteLayout的使用技巧,需要的朋友可以參考下2015-12-12
Android Studio error: Unable to start the daemon process的解決方
這篇文章主要介紹了在 Android Studio 上新建項目,出現(xiàn) Unable to start the daemon process問題的幾種的解決方法,需要的朋友可以參考下2020-10-10
Android UI設(shè)計系列之HTML標簽實現(xiàn)TextView設(shè)置中文字體加粗效果(6)
這篇文章主要介紹了Android UI設(shè)計系列之使用HTML標簽,實現(xiàn)在TextView中對中文字體加粗的效果,具有一定的實用性和參考價值,感興趣的小伙伴們可以參考一下2016-06-06
基于Android實現(xiàn)跳轉(zhuǎn)到WiFi開關(guān)設(shè)置頁的詳細步驟
在Android應(yīng)用開發(fā)中,有時候需要引導(dǎo)用戶到特定的系統(tǒng)設(shè)置頁面,例如Wi-Fi開關(guān)設(shè)置頁,可以通過隱式Intent來實現(xiàn)這一功能,以下是詳細的步驟以及相關(guān)的Kotlin代碼示例,需要的朋友可以參考下2024-09-09

