hi all i have a lil problem in android edit text
actually i made an app in which i m using two text fields for user name and password and set EditText size manually like in 200dip format. now when there is no text in the Edit Text it is in perfect size like in the image below but when we start typing text and the text exceeds the size of editText Field then it Expand downwards like in second image below.
What I want is that when text exceeds the size of EditText, it should not Change its size. please help
android:singleLine="true" should work.
add this property for EditText and check...
android:singleLine="true"
You have to do your ExitText to be single line. You can use android:singleLine but it is deprecated and it's replaced by android:inputType. Use android:inputType=text for single line and android:inputType=textMultiline for multiline
android:maxLines="1"
Another property...
Related
I'm very new to android and I want to reduce the size of EditText field in my layout.
For example if the user only need to enter 3 digits to the text field, then the size of the EditText should be small enough not the one provided by default.
Is that possible to do so?
Thanks in advance.
Try like this..
android:layout_width="wrap_content"
or
android:layout_width="20dp" //size your choice
In your Layout file set the attribute to that text field width as
android:layout_width="wrap_content"..This will take width as the text content entered into the field
You can use
android:layout_margin="size you want"
use can also use
android:layout_margin_left="size you want"
instead of "left" you can also right, top, bottom.
I am having a strange issue, the words are cutting inside EDITTEXT i have set an image as background. Plz help me... for example here ffsds, is being cut, I want it to shift to bit right so that it doesnt get cut.
Increase paddingLeft value of edit text.
...
android:paddingLeft="100dp"
...
in xml layout.
Increasing the left padding is the easy solution. But if this smiley image is always on the left of the edittext, you can set the image by using the attribute android:drawableLeft on the edittext.
working on an application
i need to take an EditText.
but i need as in the phone :-
The EditText already contains blurred text such as "Your Name" when you start typing the text vanishes and you text is shown. I hope you've seen this effect/property..
I'm not getting what this property is called to be searched on google...
Hint
http://developer.android.com/reference/android/widget/TextView.html#attr_android:hint
Use the following in your layout.xml file of edittext:
android:hint="Here your hint text"
Hey, Is it possible to specify a textview to have 25 characters in a line? I have tried android:maxLength="25" though it shows the first part of the text and the other part disappears.. Thanks
Edit1: I can also put the text into an EditText.. but I want that the characters that are after 25 chars, go to a new line..
http://developer.android.com/reference/android/widget/TextView.html#attr_android:maxLength
I am afraid, maxLength works for input EditText only. :-(
yes , sure android:maxLength="5" works for TextView to set the maximum number of characters for TextView. You can set android:layout_width="130dip" for the TextView too. That will show the character in the format abc... if the text exceed the layout width.
in my custom listview that Contain an image and EditText ,and in EditText i can comment the photo ,i can give text comment max length of 50 ,when i lost the focus in EditText i want to rearrange the text in EditText in following format
EG: suppose comment contain 40 char and user can at a time directly view only 20 char,then if i lost the focus text should be rearranged that at the end there should be 3 dot
Original Comment i wirte:eg-> eeeeeeeeeeeeeeeeeeeeeeeeeee
after i lost focus it should shown as-> eeeeeeeee...
it's importent that the nothing happens to original text because these text i want to send to server, and i directly take these values,and if am replace the text by new this type of text this will create problem, also when i gain focus i need to see full text also.
NB: i set android:singleline=true
Try android:ellipsize="end", or if you want to fade, try android:fadingEdge="horizontal"
Use the android:ellipsize="end" in you XML layout file. You can also show the scrolling text by using android:ellipsize="marquee".