File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
Underlining Edit Text
Joined: Jan 24, 2011
Aug 29, 2011 01:55:54
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.
Joined: Mar 29, 2011
Aug 30, 2011 12:29:10
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
I agree. Here's the link:
subject: Underlining Edit Text
Dynamic data within a tab using JSP
How do I use a popup box in Java?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015