展会信息港展会大全

AdapterContextMenuInfo的使用
来源:互联网   发布日期:2015-10-02 16:12:20   浏览:1683次  

导读:01/**Extra menu information provided to0203*the android.view.View.OnCreateContextMenuListener0405*.onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback when0607* a context ......

01

/**Extra menu information provided to

02

03

*the android.view.View.OnCreateContextMenuListener

04

05

*.onCreateContextMenu(ContextMenu, View, ContextMenuInfo) callback when

06

07

*a context menu is brought up for this AdapterView.

08

09

**/

10

11

public static class AdapterContextMenuInfo implements ContextMenu.ContextMenuInfo {

12

13

public AdapterContextMenuInfo(View targetView, int position, long id) {

14

this.targetView = targetView;

15

this.position = position;

16

this.id = id;

17

}

18

19

/**

20

* The child view for which the context menu is being displayed. This

21

* will be one of the children of this AdapterView.

22

*/

23

public View targetView;

24

25

/**

26

* The position in the adapter for which the context menu is being

27

* displayed.

28

*/

29

public int position;

30

31

/**

32

* The row id of the item for which the context menu is being displayed.

33

*/

34

public long id;

35

}

36

用法:

37

AdapterView.AdapterContextMenuInfo info;

38

try {

39

info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();

40

} catch (ClassCastException e) {

41

Log.e(TAG, "bad menuInfo", e);

42

return false;

43

}

赞助本站

人工智能实验室

相关热词: AdapterContextMenuInfo

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港