how to add space between HintText and Drawableleft in EditText - android

I tried adding "DrawablePadding" to it but, it is not working.
<EditText
android:drawableLeft="#drawable/ic_email"
android:textAlignment="center"
android:id="#+id/loginEmail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:singleLine="true"
android:inputType="textEmailAddress"
android:imeOptions="actionNext"
android:hint="Email"/>

remove android:ems="10" and add android:drawablePadding="5dip"

<EditText
android:id="#+id/loginEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_email"
android:drawablePadding="18dp"
android:gravity="center_vertical"
android:hint="Email"
android:inputType="textEmailAddress"
android:imeOptions="actionNext"
android:singleLine="true"
android:textColor="#939598"
android:textSize="15sp" />

Related

Floating hint label in Android Studio not showing until pressed

I am trying to use a floating label in Android Studio and it is working sometimes and not others, the hint only shows once you click on the edit text otherwise it won't show. I would like it to show the password hint like the email one before you click it
<android.support.design.widget.TextInputLayout
android:id="#+id/EmailLayout"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="#id/logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:theme="#style/TextLbl">
<android.support.design.widget.TextInputEditText
android:id="#+id/emailInput"
android:layout_width="200dp"
android:layout_height="40dp"
android:ems="10"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textSize="20sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/PassLayout"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="#id/EmailLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:theme="#style/TextLbl">
<android.support.design.widget.TextInputEditText
android:id="#+id/passInput"
android:layout_width="200dp"
android:layout_height="40dp"
android:ems="10"
android:hint="#string/password"
android:inputType="textPassword"
android:textSize="20sp" />
</android.support.design.widget.TextInputLayout>
I cannot see what is wrong with this code
Try this one:
<android.support.design.widget.TextInputLayout
android:id="#+id/PassLayout"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="#id/EmailLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:theme="#style/TextLbl">
<android.support.design.widget.TextInputEditText
android:id="#+id/passInput"
android:layout_width="200dp"
android:layout_height="40dp"
android:ems="10"
android:hint="#string/password"
android:inputType="textPersonName"
android:textSize="20sp" />
</android.support.design.widget.TextInputLayout>
in Java file:
PassLayout.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PASSWORD);
Hope this help you..if you need any help you can ask.
Try to change your code by using below Code : (Its Workable code )
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
app:passwordToggleEnabled="true"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textPassword"
android:hint="Password"
android:drawableLeft="#null"
/>
</android.support.design.widget.TextInputLayout>
or you can set Hint by java on your Activity class as :
passwordEt.setHint("Password");
that's because you're using android:inputType="textPassword" in the password edittext. Try using:
android:gravity="center"
android:ellipsize="start"

imeOption="actionNext" not working in TextInputLayout

I am using floating hint from material design. I want to shift focus from one EditText to the next, So I have put imeOptions="actionNext" in all editTexts and imeOptions="actionDone in the last EditText. But focus is not shifting to next EditText.
Below is the snippet of my xml.
<android.support.design.widget.TextInputLayout
android:id="#+id/streetWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/TextInputStyle">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Street/Locality *"
android:imeOptions="actionNext"
android:maxLines="1"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/flatWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_10sdp"
android:theme="#style/TextInputStyle">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Building Name / Flat Number*"
android:imeOptions="actionNext"
android:maxLines="1"/>
</android.support.design.widget.TextInputLayout>
You should add android:imeOptions="actionNext" in EditText section.
<android.support.design.widget.TextInputLayout
android:id="#+id/streetWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/TextInputStyle">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:maxLines="1"
android:inputType="text"/>
</android.support.design.widget.TextInputLayout>
Add attribute android:inputType="text" to your EditText.
Try this:
<android.support.design.widget.TextInputLayout
android:id="#+id/streetWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Street/Locality *"
android:imeOptions="actionNext"
android:maxLines="1"
android:inputType="text"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/flatWrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_10sdp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Building Name / Flat Number*"
android:imeOptions="actionNext"
android:maxLines="1"
android:inputType="text"/>
</android.support.design.widget.TextInputLayout>
You should add android:inputType="text" on section Tag
If you not adding inputType imeOption is not work
Try this :
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/dimens_16dp">
<android.support.design.widget.TextInputEditText
android:id="#+id/et_impian"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/text_fill_your_dream_here"
android:imeOptions="actionNext"
android:inputType="text"
android:backgroundTint="#color/color_green_manulife"/>
</android.support.design.widget.TextInputLayout>
In my case I had to also add android:nextFocusForward="#id/secondInput". Make sure you are adding id's on TextInputEditText and not on TextInputLayout.
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First input">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/firstInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:inputType="number"
android:nextFocusForward="#id/secondInput">
<requestFocus />
</com.google.android.material.textfield.TextInputEditText>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Second input">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/secondInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="text"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>

AutoCompleteTextView is not going to the next EditText

I tried singleLine=true , imeoption=ActionNext also nextfocusdown.
but autocompleteTextView is not going to next EditText.
<AutoCompleteTextView
android:id="#+id/at_quality"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#drawable/rect_border"
android:completionThreshold="1"
android:focusable="true"
android:gravity="center"
android:hint="Enter Quality"
android:singleLine="true"
android:nextFocusDown="#+id/et_design"
android:imeOptions="actionNext"
android:inputType="text"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textColor="#color/colorPrimary"
android:textSize="16sp" />
<EditText
android:id="#+id/et_design"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:singleLine="true"
android:background="#drawable/rect_border"
android:focusable="true"
android:gravity="center"
android:hint="Design"
android:imeOptions="actionNext"
android:inputType="text"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textColor="#color/colorPrimary"
android:textSize="16sp" />
so i want a solution in order to go to the above AutocompleteTextView to EditText on android softkey enter is clicked.

Display only single line at a time, in a Multiline Edittext

I have tried android:singleLine, maxLines, lineSpacing attributes but my EditText always displays a part of next line. How can I force it to display a single line at a time?
<EditText
android:layout_width="match_parent"
android:layout_height="30dp"
android:id="#+id/formulaView"
android:textColor="#000000"
android:textCursorDrawable="#drawable/visible_cursor"
android:background="#ffffff"
android:layout_marginTop="1dp"
android:textSize="18sp"
android:maxHeight="30dp"
android:gravity="center_vertical"
android:layout_marginBottom="1dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:scrollbars="vertical"
android:imeOptions="actionNext"
android:completionThreshold="1"
android:inputType="textMultiLine|textNoSuggestions"/>
Don't Use
android:inputType="textMultiLine|textNoSuggestions"
Instead use:
android:inputType="textNoSuggestions"
Code:
<EditText
android:layout_width="match_parent"
android:layout_height="30dp"
android:id="#+id/formulaView"
android:textColor="#000000"
android:background="#ffffff"
android:layout_marginTop="1dp"
android:textSize="18sp"
android:text="=SUM(android,Hello,How,Are,You) GoodMorining"
android:maxHeight="30dp"
android:gravity="center_vertical"
android:layout_marginBottom="1dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:scrollbars="vertical"
android:imeOptions="actionNext"
android:completionThreshold="1"
android:singleLine="true"
android:inputType="textNoSuggestions"/>
Hope this will help.
Have a great day ahead.

How to get EditText to not suggest text in android

I have an EditText that I need to not suggest texts as user types. But I can't seem to get that to work. Here is the code
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:hint="#string/email_hint"
android:imeActionId="#+id/login"
android:inputType="textNoSuggestions|textEmailAddress"
android:maxLines="1"
android:singleLine="true"
android:textColor="#000000" />
I solved my problem with
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:hint="#string/email_hint"
android:imeActionId="#+id/login"
android:inputType="textNoSuggestions|textVisiblePassword"
android:maxLines="1"
android:singleLine="true"
android:textColor="#000000" />

Categories

Resources