获取操作栏菜单项的屏幕坐标以创建简介屏幕 [英] Getting screen coordinate of action bar menu item for creating introduction screen
本文介绍了获取操作栏菜单项的屏幕坐标以创建简介屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有可能获得操作栏菜单项的屏幕坐标?
I was wondering, if there is any possibility of getting the screen coordinates of an action bar menu item?
我想创建一个介绍屏幕,绘制一个指向所需动作栏菜单项的箭头,以便用户知道从哪里开始.
As I would like to create an introduction screen, to draw an arrow pointing to the desired action bar menu item, so that the user knows where to start.
推荐答案
这是我的操作方式:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId().equals(R.id.my_menu_item)) {
View menuView = findViewById(R.id.menu_item_search);
int[] location = new int[2];
menuView.getLocationOnScreen(location);
int menuViewX = location[0];
int menuViewY = location[1];
}
}
这篇关于获取操作栏菜单项的屏幕坐标以创建简介屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文