amlcurran / ShowcaseView

[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly
5.6k stars 1.29k forks source link

Button positioning API #453

Open alexfu opened 6 years ago

alexfu commented 6 years ago

Would be nice to have an abstracted API to set the buttons position without having to know the details of the underlying layout (i.e. RelativeLayout). Ideally, I would just be able to do this:

ShowcaseView showcaseView = ShowcaseView.Builder(activity).build();
showcaseView.setButtonPosition(Gravity.TOP|Gravity.LEFT);

or something similar, as opposed to:

ShowcaseView showcaseView = ShowcaseView.Builder(activity).build();
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
showcaseView.setButtonPosition(lps);

Also, if the underlying layout ever changes, then the public facing API would certainly need to change. Not exactly ideal.