Reputation: 304
This is my two EditText Username and Password and I'm using TextInputLayout
<LinearLayout
android:id="@+id/linear2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/linear1"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/tplUserName"
style="@style/EditText_Style_1"
app:hintTextAppearance="@style/TextLabel">
<EditText
android:id="@+id/etUserName"
style="@style/StandardEditTextStyle"
android:hint="@string/un_login"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/tplPassword"
style="@style/EditText_Style_1"
app:hintTextAppearance="@style/TextLabel"
android:hint="@string/pass_login">
<EditText
android:id="@+id/etPassword"
style="@style/EditText_Style_For_All"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
This is my style,EditText_Style_1
for TextInputLayout and EditText_Style_For_All for EditText.I set "maxLines" attribute to both styles but when I change next EditText(Password) by pressing "Enter" from android keyboard, it didn't work.I set singleLine and I work for me.You know this attribute is deprecated.
<style name="EditText_Style_1">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColorHint">@color/textColor</item>
<item name="android:layout_marginRight">@dimen/reg_margin_right</item>
<item name="android:layout_marginLeft">@dimen/reg_margin_left</item>
<item name="android:fontFamily">sans-serif-thin</item>
<item name="android:maxLines">1</item>
</style>
<style name="EditText_Style_For_All">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">@color/edit_text_color</item>
<item name="android:backgroundTint">@color/et_underline_color</item>
<item name="android:fontFamily">sans-serif-thin</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">15sp</item>
<item name="android:maxLines">1</item>
</style>
Upvotes: 1
Views: 1928
Reputation: 610
<EditText
android:id="@+id/etUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="5"
style="@style/StandardEditTextStyle"
android:hint="@string/un_login"
/>
You just need to make sure you have the attribute "inputType" set. It doesn't work without this line.
android:inputType="text"
Upvotes: 0
Reputation: 3219
add <item name="android:inputType">text</item>
also. it will not work without inputType
Upvotes: 1
Reputation: 9732
Try this set android:imeOptions="actionNext"
and also set android:inputType="text"
to Your EditText
Sample Code
<android.support.design.widget.TextInputLayout
android:id="@+id/tplUserName"
style="@style/EditText_Style_1"
app:hintTextAppearance="@style/TextLabel">
<EditText
android:id="@+id/etUserName"
style="@style/StandardEditTextStyle"
android:imeOptions="actionNext"
android:inputType="text"
android:hint="@string/un_login"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/tplPassword"
style="@style/EditText_Style_1"
app:hintTextAppearance="@style/TextLabel"
android:hint="@string/pass_login">
<EditText
android:id="@+id/etPassword"
android:imeOptions="actionNext"
android:inputType="textPassword"
style="@style/EditText_Style_For_All"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
Upvotes: 4