Targeting action bar menu items with ShowCaseView

2019-08-14 18:06发布

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条回答
姐就是有狂的资本
2楼-- · 2019-08-14 18:56

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();
查看更多
登录 后发表回答