0
時是內部CardView的EditText上imeOption不工作,我試着像添加imeOption代碼不同的選項:ImeOption做了不工作時的EditText裏面Cardview
editPassword.setImeOptions(EditorInfo.IME_ACTION_DONE);
的XML,我使用是:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/normal_padding_screen"
android:layout_marginEnd="@dimen/normal_padding_screen"
app:cardBackgroundColor="@android:color/white"
app:cardElevation="6dp">
<EditText
android:id="@+id/editTextEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="8dp"
android:hint="@string/hint_email"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:drawableStart="@drawable/ic_mail"
android:drawablePadding="8dp"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginStart="@dimen/normal_padding_screen"
android:layout_marginEnd="@dimen/normal_padding_screen"
android:layout_marginBottom="10dp"
android:descendantFocusability="beforeDescendants"
app:cardBackgroundColor="@android:color/white"
app:cardElevation="6dp">
<EditText
android:id="@+id/editTextPass"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="8dp"
android:lines="1"
android:imeOptions="actionDone"
android:hint="@string/hint_password"
android:drawableStart="@drawable/ic_password"
android:drawablePadding="12dp"/>
</android.support.v7.widget.CardView>
</LinearLayout>
但仍然設置爲EditText上「actionDone」在鍵盤我看到「輸入/ next_line」
的選擇密碼的imeOption 0
在編輯文本中嘗試'android:singleLine =「true」'' –