android intent使用定义标题_安卓软件开发教程-查字典教程网
android intent使用定义标题
android intent使用定义标题
发布时间:2016-12-28 来源:查字典编辑
摘要:可以使用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中

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新安卓软件开发学习
    热门安卓软件开发学习
    编程开发子分类