手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >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开发之OpenGL ES 画多边形

Android Studio使用教程图文详解

android 更新Preference的UI显示

Android在JNI中使用ByteBuffer的方法

Android 使用XML做动画UI的深入解析

Android控件系列之ImageView使用方法

解决android tabhost 个别版本视图重叠问题

Android开发笔记 Handler使用总结

Android 开发中怎么使用自定义字体

android操作SQLite增删改减实现代码

精品推荐
分类导航