手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android intent使用定义标题
android intent使用定义标题
摘要:可以使用Intent.createChooser()的方法来创建Intent,并传入想要的Sting作为标题。以wallpaper选择框为例...

可以使用 Intent.createChooser() 的方法来创建 Intent,并传入想要的 Sting 作为标题。

以wallpaper 选择框为例,当在Launcher workspace的空白区域上长按,会弹出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对应的字串内容就是”Choose wallpaper from”,定义在Launcher2的Strings.xml中

【android intent使用定义标题】相关文章:

Android Studio使用教程图文详解

Android控件系列之ImageView使用方法

android广播接收者实例

Android开发之软键盘用法实例分析

解析android截屏问题

Android GridView的使用

android RadioGroup的使用方法

Android实现隐藏状态栏和标题栏

android 更新Preference的UI显示

Android Service中方法使用详细介绍

精品推荐
分类导航