Reputation: 727
I have a multi line textview in my app and I want to make a bar where the user can click in bold/italic buttons and either the selected area in the multiline will become bold/italic OR the text the user types will be bold until the user deselects bold/italic.
Is this possible? If so can someone gives some sample code. I am new to programming in android so this is difficult.
EDIT: Changing font size and font is an extra but will be good if possible. EDIT: Forgot to say using android 5.0, not that it makes too much of a difference.
Upvotes: 1
Views: 101
Reputation: 1241
Yes ,you can set the text style and font by using a method just use if else statement in the method and pass an integer
if(i==0){
textView.setTypeface(null, Typeface.BOLD);
}
else if(i==1){
textView.setTypeface(null, Typeface.ITALIC);}
You can do some thing like this it's not the complete as I write from my mind. hope it will help ,And in the similar way you can set the text size also.
Upvotes: 1