Lompat ke konten Lompat ke sidebar Lompat ke footer

How To Set Text Underline In Android

How To Set Text Underline In Android. When the user press the button for changing the style then save the text lenght so in the textwatcher after the text change you apply the style selected. Add a string in the xml file and add the below code.

Change TextInputLayout underline color in android tutorial Android
Change TextInputLayout underline color in android tutorial Android from www.android-examples.com

Also, we are using the setspan method to set the foreground color of text starting from the 36th position and ending at the 44th position in the string. To create a new project in android studio please refer to how to create/start a new project in android. Create an xml file add below code.

Spannablestring Myspannablestring = New Spannablestring (My String);


Below is the code for dashed_underline.xml comments is added for a better understanding of the code. Also, we are using the setspan method to set the foreground color of text starting from the 36th position and ending at the 44th position in the string. But both solutions use the same color for the text and the underline indicator.

When The User Press The Button For Changing The Style Then Save The Text Lenght So In The Textwatcher After The Text Change You Apply The Style Selected.


You have to use spannablestring for that :. Create android application in android studio. Create a new project “ build your first android app in kotlin “.

Navigate To The App > Res > Layout > Activity_Main.xml And Add The.


And this question should help you with the text listener android on text change listener. Create a new project in android studio. In this example i will show you make text under line in 2 ways.

To Create A New Project In Android Studio Please Refer To How To Create/Start A New Project In Android.


Create an xml file add below code. Paint p = _textview.getpaintflags (); Textview thetextview = new textview (this);

Working With The Activity_Main.xml File.


Content.setspan (new underlinespan (), 0, test.length (), 0); So let's create underline text android application. Also, we are passing some flags with it i.e.

Posting Komentar untuk "How To Set Text Underline In Android"