-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When you set the title, the content text is transparent. #83
Comments
This was a stylistic choice to draw attention to the title by reducing the colour of the content. |
Yes, but the user can set this in setContentTextColor, setting a transparent color. As you said, it should be a choice and i didn't like the way it was. =( |
@sandro-csimas has a very valid point. It is not intuitive to change the content style based on the title text. Doing so removes too much control from the developer. Now if I want to have full control over the text I'll have to use Spannables with line breaks, set that as the content text and avoid setting the title all together which is a very cumbersome solution to this issue. All that being said. I'm loving this library. Thanks! |
Agree that this should NOT exist in the library, but offloaded to the developer. Opacity should not change. |
This can be solve via reflection like described here: #7 (comment)
` |
Without Reflection, you can use // Not a very good way
private fun getShowcaseContent(): SpannableString {
val title = "New Feature! \n\n"
val content = "Check out this awesome new feature, blah blah blah! 🥳"
val spannableString = SpannableString(title + content)
// 1.5f for title i.e. default text size * 1.5f
spannableString.setSpan(RelativeSizeSpan(1.5f), 0, title.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
// 0.85f for content i.e. default text size * 0.85f, smaller than the title
spannableString.setSpan(RelativeSizeSpan(0.85f), title.length + 1, (title + content).length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
return spannableString
} Usage: MaterialShowcaseView.Builder(this@Activity)
.setTarget(view)
// remember to set ONLY the CONTENT
.setContentText(getShowcaseContent())
// I don't need the dismiss button, so...
.setDismissText("")
.setTargetTouchable(true)
.withCircleShape()
.setDelay(250)
.setDismissOnTargetTouch(true)
.singleUse("show_case")
.show() This should fix the |
Why this code sets the mContextTextView alpha to 0.5?
Setting the content text color does not solve the problem...
The text was updated successfully, but these errors were encountered: