Use ShowCaseView with ActionBarCompat / ActionBarSherlock Android

一世执手 提交于 2019-12-05 23:50:15

I solved that issue.Replace code of OnCreateOptionsMenu() with following code.

Code:

@Override
    public boolean onCreateOptionsMenu(Menu menu) {

        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);

        sv = ShowcaseView.insertShowcaseViewWithType(ShowcaseView.ITEM_ACTION_ITEM,
            R.id.action_edit, FaceFrameActivity_dual.this,"Edit", 
           "Click here to edit image.", co);
     }

See this blog post. I am using the support library and it works fine.

The following code will create three views that show back to back (overflow menu, a view in my page, and an action bar item).

    ShowcaseViews views = new ShowcaseViews(activity, new ShowcaseViews.OnShowcaseAcknowledged() {
        @Override
        public void onShowCaseAcknowledged(ShowcaseView showcaseView) {
            Toast.makeText(activity, "clicked", Toast.LENGTH_SHORT).show();
        }
    });

    views.addView(new ShowcaseViews.ItemViewProperties(ShowcaseViews.ItemViewProperties.ID_OVERFLOW, R.id.test, R.id.test, ShowcaseView.ITEM_ACTION_OVERFLOW));
    views.addView(new ShowcaseViews.ItemViewProperties(R.id.search_keyword, R.string.test, R.string.test, 0.5f));
    views.addView(new ShowcaseViews.ItemViewProperties(R.id.action_refresh, R.string.test, R.string.test, ShowcaseView.ITEM_ACTION_ITEM, 0.5f));
    views.show();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!