Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Experimentation for Engineers: From A/B testing to Bayesian optimization
this week in the
Design
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Tim Cooke
Paul Clapham
Liutauras Vilda
Sheriffs:
Junilu Lacar
Rob Spoor
Jeanne Boyarsky
Saloon Keepers:
Stephan van Hulst
Carey Brown
Tim Holloway
Piet Souris
Bartenders:
Forum:
Android
Underlining Edit Text
Sahil Reddy
Ranch Hand
Posts: 145
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello Pals
I want to set text in Edit box as Underline , so that when user types anything in Edit text box, it appears as Underlined.
For instance when i setTextSize(26); , when user types anything it shows text in size =26. Now i want to achieve the same thing for Underlining.
Regards
Mario Alcantara
Greenhorn
Posts: 16
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You need an object of type Editable, this object will store the text that the user typed and also need an objecto of type StyleSpan. The StyleSpan class allow you use different styles over your EditText component, here a very small example:
//Create a Editable object Editable str = Editable.Factory.getInstance().newEditable("Esto es un simulacro."); //Apply the Typeface.BOLD Style to the word "simulacro" str.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 11, 19, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //Assign the "text with style" to EditText component final EditText txtTexto = (EditText)findViewById(R.id.TxtTexto); txtTexto.setText(str);
Sorry, my english isn't good
source:
http://www.sgoliver.net/blog/?p=1373
Your mother was a hamster and your father was a tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Validation
Dynamic data within a tab using JSP
How do I use a popup box in Java?
OnChange Event
Javascript
Low Tech Laboratory Movie Kickstarter - March 2023
More...