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ū)域上長按,會(huì)彈出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ū)域上長按,會(huì)彈出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啟動(dòng)別的應(yīng)用實(shí)現(xiàn)方法
- Android利用Intent啟動(dòng)和關(guān)閉Activity
- Android開發(fā)之利用Intent實(shí)現(xiàn)數(shù)據(jù)傳遞的方法
- Android常用的intent action匯總
相關(guān)文章
Android IPC機(jī)制Messenger實(shí)例詳解
這篇文章主要介紹了 Android IPC機(jī)制Messenger實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下2017-07-07詳解 Kotlin Reference Basic Types, String, Array and Imports
這篇文章主要介紹了詳解 Kotlin Reference Basic Types, String, Array and Imports的相關(guān)資料,需要的朋友可以參考下2017-06-06解決Android Studio sdk emulator directory is missing問題
這篇文章主要介紹了解決Android Studio sdk emulator directory is missing問題,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-11-11Android自定義控件實(shí)現(xiàn)九宮格解鎖功能
這篇文章主要為大家詳細(xì)介紹了Android自定義控件實(shí)現(xiàn)九宮格解鎖功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-05-05android中SwipeRefresh實(shí)現(xiàn)各種上拉,下拉刷新示例
這篇文章主要介紹了android中SwipeRefresh實(shí)現(xiàn)各種上拉,下拉刷新示例,非常具有實(shí)用價(jià)值,需要的朋友可以參考下。2017-03-03Android開發(fā)中比較耗時(shí)的一些操作小結(jié)
這篇文章主要介紹了Android開發(fā)中比較耗時(shí)的一些操作小結(jié),本文根據(jù)實(shí)際開發(fā)經(jīng)驗(yàn)總結(jié)了6條比較耗時(shí)的編程操作,請大家注意下,需要的朋友可以參考下2015-06-06Android studio 下的APK打包失敗問題解決辦法
這篇文章主要介紹了Android studio 下的APK打包失敗問題解決辦法的相關(guān)資料,需要的朋友可以參考下2017-05-05