我有customEditText
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/five_margin"
android:focusableInTouchMode="true"
android:orientation="horizontal"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
>
<EditText
android:id="@+id/edt_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="@dimen/sub_heading"
android:textColorHint="@color/hind_text_col0r"
android:inputType="textCapSentences|textAutoCorrect|textMultiLine"
android:textColor="@color/active_text_col0r"
/>
</android.support.design.widget.TextInputLayout>
并使用它如下
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.paisa.main.base.ui.widget.CustomEditText
android:id="@+id/custom_edt_investor_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
/>
<com.paisa.main.base.ui.widget.CustomEditText
android:id="@+id/custom_edt_nominee_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
如何通过软输入键盘将投资者名称移至被提名人姓名编辑文本 我接下来使用了imeoption它没有隐藏键盘。
答案 0 :(得分:0)
这将有助于您: - 为所有TextView ...
制作此功能custom_edt_investor_name.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "enter" button
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER))
{
// Perform action on Enter key press
custom_edt_investor_name.clearFocus();
custom_edt_nominee_name.requestFocus();
return true;
}
return false;
}
});
答案 1 :(得分:0)
使用android:nextFocusDown
参数指定当用户点击回车键时您希望获得焦点的字段。
示例:
android:inputType="text"
android:nextFocusDown="@+id/..."