In my android app development, I have one button, the button text is not a single color text, it is two lines text, with each line uses different color for line text. How to implement this? "Two lines" can be simply implemented by adding "\n" in the text, I don know how to set different colors for each line text on the button. Anyone can help?
Try to use Html.fromHtml when setting text to a button:
Button button = (Button) getElementById(R.id.some_button);
button.setText(Html.fromHtml("<font color='red'>First line</font><br/><font color='blue'>Second line</font>"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With