Android EditText not Multi Line [duplicate] - android

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
restrict edittext to single line
I have 2 edit texts. My problem is, when I press the enter button in the keyboard, it creates another set of line. Or it creates like a next line in my edit text. I want to remove it and I want it to be in single line. Even if I enter the enter key in the keyboard, still it won't create a next line.
How do you do it?

Try this in your EditText xml
android:singleLine="true"

<EditText
android:id="#+id/edittextView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:singleLine="true"/>
Try this with your edit text in layout

Related

Password edittext hint text alignment on right side [duplicate]

This question already has answers here:
Android RTL password fields?
(6 answers)
Closed 6 years ago.
I'm facing an issue that when I define an EditText as password type and view my screen in Arabic language the password field hint text is showing on the left side instead of right side [that is expected].
Above is the result I get. I need password hint text to be starting from the right side that's where Arabic writings start. I've also tried adding text gravity to it but no luck.
Please refer to this post :
Android RTL password fields?
For API 17+ you can use
android:textAlignment="viewStart"
Try this:
<EditText
android:id="#+id/input_password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="كلمة المرور"
android:textColorHint="#FFFFFF"
android:gravity="right"
android:inputType="textPassword"
android:background="#null"
android:textColor="#FFFFFF"
android:textSize="20dp"/>

Android - How put a backgroud text in a EditText? [duplicate]

This question already has answers here:
Android EditText background text
(2 answers)
Closed 6 years ago.
I have putted a EditText in a XML.
I want to use this EditText to the user insert his name.
I want that appears in this EditText the text "Insert the Name", but when the user click on it, the text "Insert the Name" disappear, so the user don't need to delete the phrase "Insert the Name".
I want the same "Event name" effect in this image:
What is needed to do in the EditText to get this effect?
Thanks!
Add hint in your Editext in your xml File
<EditText
android:id="#+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Insert Name"/>
This will be helpful:
How to clear the selection in an EditText?
do it programatically by using:
myEditText.clearFocus();
which fills it up with actual text
or xml:
android:hint="text here"
which is unselectable greyed out 'hint' text you want

TextInputLayout does not show hint in Edit Text [duplicate]

This question already has answers here:
TextInputLayout not showing EditText hint before user focus on it
(17 answers)
Closed 7 years ago.
Below is the code that I am using. TextInputLayout is included as a part of Androids new Design library. But it does show the hint inside of the EditText. Am I using this the wrong way?
Once I click on the EditText the hint text animation works properly. Also when I click on some other EditText the hint text returns properly. So that is also not an issue. But I am not able to view the hint text in the first place.
<android.support.design.widget.TextInputLayout
android:id="#+id/tilDrugName"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/edtDrugName"
style="#style/ETPrescription"
android:hint="#string/drug_name"/>
</android.support.design.widget.TextInputLayout>
As far as I have come across, this has been a bug in Android Support library for design.
Android Source Bug
So I think this will be resolved in upcoming updates.

How to replace text in a textfield when user enters any character [duplicate]

This question already has answers here:
TextView to display hint before text entered
(2 answers)
Closed 8 years ago.
In my android app I have a text field that says "how much would you like to take".
I want the text to be erased automatically and replaced by what the user inputs when they type in that textfield.
Example: if the user enters one character it automatically deletes "how much would you like to take" from the text field and replaces it with the one character that's been entered.
In your xml file use
android:hint="how much would you like to take"
in your TextView definition
(Well, it should be something like "#string/how_much" and that how_much string in strings.xml, but honestly...)
Its called android:hint property of a EditText you can set it into your xml file.
Something like that.
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="how much would you like to take" />
Try this in your xml
Use this in below code android:hint="how much would you like to take"
<EditText
android:id="#+id/edtName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txtName"
android:layout_marginRight="5dip"
android:hint="how much would you like to take"
android:inputType="textCapSentences"
/>
Hope it helps

Android EditText default numeric keyboard and allow text [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
EditText with number keypad by default, but allowing alphabetic characters
Wondering if it is possible to default to a numeric keyboard on focus for an edittext field but also allow users to input characters? None of the input types seem to support this.
Thanks!
I just tried to add a number text field in Android and it ran in the emulator fine. It defaults to bring up the number pad first, but you can switch to characters just as easy. So try to use a number text field.
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number" />

Categories

Resources