MaterialShowcaseView
MaterialShowcaseView copied to clipboard
Add action item as a target
hi, how can i add action item in the Action Bar (e.g home button, settings) as a target? thank you
activity.findViewById(R.id.action_item) should work after menu is created in onCreateOptionsMenu()
While my pull request is awaiting review, you can check out my fork of this library (there is example with action item and it also supports custom padding, rectangle shape) :)
@ntoskrnl thank you for your fast response i tried sample sequence activity and i add the menu item at onCreateOptionsMenu() like you said
http://codepad.org/9XtTOnUU
but it got nullpointer exception...
You should show the viewcase only if the activity has already drawn all it's views. A good point for showing it would be your activity's onResume...
@MFlisar thank you for your response. i called it in onResume and still got error i end up with calling it with postDelayed method at onCreate with 500ms delay and it worked! i already checked the logcat, onResume method called when activity still not drawn all its views.
this is my final code Handler myHandler = new Handler(); myHandler.postDelayed(new Runnable() { @Override public void run() { showMaterialShowCase(); } }, 500);
Another good way that is not hoping for good timing is following:
Post a method on a view directly or add a GlobalLayoutObserver and remove it after the first call...
I use the view.post(...) method and had never a crash based on that yet...
Hi it does not work with the new toolbar
@huteri it does work, in my project i use the new toolbar
@cardovaeric I could not make it work with activity.findViewByid() in onCreateOptionsMenu, but it does work with Toolbar.findViewById()
This worked for me
if(getActivity().findViewById(R.id.menu_item)!=null) sequence.addSequenceItem(getActivity().findViewById(R.id.menu_item), "Description", "GOT IT");
The answer here works for me.
thank you very much @balavishnu and @cardovaeric this work for me if(getActivity().findViewById(R.id.menu_item)!=null) sequence.addSequenceItem(getActivity().findViewById(R.id.menu_item), "Description", "GOT IT");
AND
Handler myHandler = new Handler(); myHandler.postDelayed(new Runnable() { @Override public void run() { showMaterialShowCase(); } }, 500);
I found a better solution with
OnCreate:
toolbar.post(new Runnable() {
@Override
public void run() {
showMaterialShowCase();
}
});
How can we put SKIP button same like GOT IT button in ShowcaseView so that we can skip rest introduction showcaseViw ? any one know? please help me if any one know thanks...
I found a better solution with
OnCreate:
toolbar.post(new Runnable() { @Override public void run() { showMaterialShowCase(); } });
Thank you this worked for me. I was using toolbar menu with animated Lottie files as each item. This worked for me just fine