You can also use a SpannableStringBuilder. Here's a contrived example, but it
shows the basics:
TextAppearanceSpan span = new TextAppearanceSpan(mContext,
R.style.MyTextAppearance);
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append("First line\nSecond line");
builder.setSpan(span, 0, 10, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
text.setText(builder);
That assumes you've got a text style in styles.xml, something like:
<style name="MyTextAppearance">
<item name="android:textColor">#ffff0000</item>
</style>
Rich
On 24 Nov 2010, at 14:26, pedr0 wrote:
> If your text will never change you can apply an image at your botton,
> in your image you can do that without problem.
>
>
> On 24 Nov, 14:57, xi developer <[email protected]> wrote:
>> 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
>> (with details)?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en