MaterialShowcaseView
MaterialShowcaseView copied to clipboard
How to underline and setBackgroundColor to DismissText?
I want to underline and set a background color to dismiss text. How can i achieve this? I tried to underline the text following is the code.
new MaterialShowcaseView.Builder(ProfileActivity.this)
.setTarget(rlHeaderMediaVault)
.setDismissOnTargetTouch(true)
.setContentTextColor(R.color.darkBlue)
.setDismissText("<u>GOT IT</u>")
.setContentText("Click on Media Vault to start Locking Media files")
.setDelay(500)
.singleUse("two time")
.show();
}
But it shows underline as it is.
As you can see setDismissOnTargetTouch
is true. But when i click the target view it does not dismiss the showcase.
The underline can be done with a spannable. Here's a helper method I use to underline the dismiss text.
public CharSequence underlineText(CharSequence text) {
SpannableString content = new SpannableString(text);
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
return content;
}
Just give it your text like NEXT
and it will return a Charsequence that can be given to setDismissText
.
It would be nice to set the background color of the button instead, but unfortunately the current api does not grant us access to do so. So for now I'll just live with the underline.
Doesn't work for me :S
sequence.addSequenceItem(multibutton, "Text.", Utility.underlineText("DISMISS").toString());
private static void setBackToTextView(MaterialShowcaseView input) {
try {
Field field = input.getClass().getDeclaredField("mDismissButton");
field.setAccessible(true);
((TextView) field.get(input)).setBackgroundResource(R.drawable.holo);
((TextView) field.get(input)).setPadding(30, 13, 18, 13);
} catch (Exception e) {
e.printStackTrace();
}
}