源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

android intent使用定义标题

  • 时间:2021-07-16 17:55 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:android intent使用定义标题
可以使用 Intent.createChooser() 的方法来创建 Intent,并传入想要的 Sting 作为标题。 以wallpaper 选择框为例,当在Launcher workspace的空白区域上长按,会弹出wallpaper的选择框,选择框的标题为”Choose wallpaper from”,如下:
[u]复制代码[/u] 代码如下:
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中
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部