Created
August 29, 2017 22:47
-
-
Save Bahaaib/6d132d7fdf752b1c2b9f1d324c68b18b to your computer and use it in GitHub Desktop.
Custom spannable String builder to overcome any kind of properties of texts (color, size, etc..) built in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private SpannableStringBuilder customErrorText(String msg){ | |
| int eColor = Color.parseColor("#000000"); // whatever color you want | |
| ForegroundColorSpan fgcspan = new ForegroundColorSpan(eColor); | |
| SpannableStringBuilder textBuilder = new SpannableStringBuilder(msg); | |
| textBuilder.setSpan(fgcspan, 0, msg.length(), 0); | |
| return textBuilder; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment