Targeting action bar menu items with ShowCaseView

Deadly 提交于 2019-12-24 15:06:13

问题


How can I target the action bar menu items with ShowCaseView.

I have tried using the following code located here and I am getting ITEM_ACTION_ITEM cannot be resolved or is not a field

How can I target specific ActionBar menu items using ShowCaseView? thanks

        ShowcaseView sv = ShowcaseView.insertShowcaseViewWithType(ShowcaseView.ITEM_ACTION_ITEM,
            R.id.answers, FragmentViewNovice.this,"Edit", 
           "Click here to edit image.");    

回答1:


For future Googlers, I have found the answer.

new ShowcaseView.Builder(getActivity())
    .setTarget(new ActionItemTarget(getActivity(), R.id.answers)) //Here is where you supply the id of the action bar item you want to display
    .setContentTitle("Title")
    .setContentText("Description")
    .hideOnTouchOutside()
    .build();


来源:https://stackoverflow.com/questions/28224301/targeting-action-bar-menu-items-with-showcaseview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!