Android7.0中文文档(API)-- ShareActionProvider
来源:互联网 发布:微信扫码抽奖软件 编辑:程序博客网 时间:2024/05/17 17:17
完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/ShareActionProvider.html
ShareActionProvider
public class ShareActionProvider
extends ActionProvider
This is a provider for a share action. It is responsible for creating views that enable data sharing and also to show a sub menu with sharing activities if the hosting item is placed on the overflow menu.
一个分享操作的provider。它负责创建支持数据分享的视图,并且如果将托管项放置在溢出菜单上,还可以显示带有分享activity的子菜单。
Here is how to use the action provider with custom backing file in a MenuItem
:
下面是如何在MenuItem
中使用自定义支持文件的ActionProvider:
// In Activity#onCreateOptionsMenu public boolean onCreateOptionsMenu(Menu menu) { // Get the menu item.MenuItem menuItem = menu.findItem(R.id.my_menu_item); // Get the provider and hold onto it to set/change the share intent. mShareActionProvider = (ShareActionProvider) menuItem.getActionProvider(); // Set history different from the default before getting the action // view since a call toMenuItem.getActionView()
calls //onCreateActionView()
which uses the backing file name.Omit this // line if using the default share history file is desired. mShareActionProvider.setShareHistoryFileName("custom_share_history.xml"); .。。} // Somewhere in the application. public void doShare(Intent shareIntent) { // When you want to share set the share intent. mShareActionProvider.setShareIntent(shareIntent); }
Note: While the sample snippet demonstrates how to use this provider in the context of a menu item, the use of the provider is not limited to menu items.
注意:尽管示例代码片段演示了如何在菜单项的上下文中使用该provider,但provider的使用并不仅限于菜单项。
See also:
另请参考:
ActionProvider
摘要
嵌套类
interface
ShareActionProvider.OnShareTargetSelectedListener
Listener for the event of selecting a share target.
监听器,其监听选择一个共享目标的事件。
常量
String
DEFAULT_SHARE_HISTORY_FILE_NAME
The default name for storing share history.
存储分享历史的默认文件名称。
Public构造方法
ShareActionProvider(Context context)
Creates a new instance.
创建一个新的实例。
- Android7.0中文文档(API)-- ShareActionProvider
- Android7.0中文文档(API)--- FrameLayout
- Android7.0中文文档(API)--- DatePicker
- Android7.0中文文档(API) --- MediaController
- Android7.0中文文档(API)--- TabHost
- Android7.0中文文档(API) -- TimePicker
- Android7.0中文文档(API)-- ViewAnimator
- Android7.0中文文档(API)--- AbsoluteLayout
- Android7.0中文文档(API) -- Switch
- Android7.0中文文档(API) --- ToggleButton
- Android7.0中文文档(API) --- RadioButton
- Android7.0中文文档(API) --- CheckedTextView
- Android7.0中文文档(API) -- ScrollView
- Android7.0中文文档(API)-- DigitalClock
- Android7.0中文文档(API)-- TextClock
- Android7.0中文文档(API)---Chronometer
- Android7.0中文文档(API)--- AdapterView
- Android7.0中文文档(API)--- AdapterViewAnimator
- 【转载】Jforum环境安装
- 遍历Map的四种方式与sql优化
- 新款安卓架构设计-Architecture Components介绍
- 对象克隆
- GIC-400寄存器 之CPU接口
- Android7.0中文文档(API)-- ShareActionProvider
- Solr单集代码调用案例
- UVa12100
- Let the Balloon Rise
- [mark]Chrome webdriver 下载
- [机器学习入门] 李弘毅机器学习笔记-17(Unsupervised Learning: Deep Auto-encoder;无监督学习:深度自动编码器)
- Error:Execution failed for task ':xxx:compileReleaseJavaWithJavac'.
- String、StringBuffer、StringBuilder
- Document对象,Element对象和Node对象简介