Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add hint into EditText with inputType="numberDecimal"?

I have an EditText like below:

<EditText
android:id="@+id/et_sum"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:background="@android:drawable/editbox_background"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:hint="Enter sum" />

But the hint is not displayed. Is it possible to display the EditText hint with inputType="numberDecimal" or not?

like image 722
IgorOK Avatar asked Nov 16 '11 18:11

IgorOK


People also ask

What is the EditText attribute android inputType used for?

The android:inputType attribute allows you to specify various behaviors for the input method. Most importantly, if your text field is intended for basic text input (such as for a text message), you should enable auto spelling correction with the "textAutoCorrect" value.

How do I add an icon to EditText?

2- First thing we need to do is to look for icons that we can use them for the android edittext. Right click on res folder → New → Vector Asset . Adjust the size from (24dp x 24dp) to (18dp x 18dp), choose the icon that you want by clicking on the android icon, click “Next” button and then click “Finish”.

How can add only numbers in EditText in android?

Using phone inputType EditText has an attribute called android:inputType . Providing android:inputType with value phone can display numbered keyboard when the EditText gets focus. Create an Android Project and replace layout (activity_main. xml) and Kotlin file (MainActivity.


1 Answers

you can use

android:ellipsize="start"

to make the hint displayed with an inputtype and gravity

like image 88
SKT Avatar answered Sep 20 '22 08:09

SKT