Android 如何阻止numberpad跳转到下一个文本视图?
我的布局如下所示。通常,用户只需填写第一个框(etItemQty),然后即可保存数据-如何阻止键盘允许用户进入“下一个”编辑框(即etItemPrice)。我只希望用户能够点击etItemPrice,如果他们想编辑它。在其他语言中,我没有给它一个制表符位置——这可能吗Android 如何阻止numberpad跳转到下一个文本视图?,android,Android,我的布局如下所示。通常,用户只需填写第一个框(etItemQty),然后即可保存数据-如何阻止键盘允许用户进入“下一个”编辑框(即etItemPrice)。我只希望用户能够点击etItemPrice,如果他们想编辑它。在其他语言中,我没有给它一个制表符位置——这可能吗 <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/and
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp" >
<TextView
android:id="@+id/lbProducts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sm_lbProduct"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="@+id/spinProducts"
android:layout_width="210dp"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="321dp"
android:layout_height="wrap_content"
android:padding="5dp" >
<TextView
android:id="@+id/lbProductQty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sm_lbProductQty"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/etProductQty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="50px"
android:inputType="phone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp" >
<TextView
android:id="@+id/lbPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/sm_lbProductPrice"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/etProductPriceExGST"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100px"
android:inputType="numberDecimal" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<Button
android:id="@+id/cmdAddItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/sm_cmdAddProduct" />
</LinearLayout>
<LinearLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<ListView
android:id="@+id/listViewOrders"
android:layout_width="fill_parent"
android:layout_height="141dp" >
</ListView>
</LinearLayout>
</LinearLayout>
试试这个
etItemQty.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// TODO Auto-generated method stub
if(event.getKeyCode()==KeyEvent.KEYCODE_ENTER)
{
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(etItemQty.getWindowToken(), 0);
}
return false;
}
});
这仅仅是在用户按下enter键时关闭它,还是在到达textview之前关闭它?当用户按下enter键时它将关闭…您如何知道用户完成了输入?如果焦点从一开始就没有转到textview,那将是完美的,即“下一步”不会出现在软键盘上。如何删除软键盘中的
next
?是否有文本视图设置阻止它出现在软键盘遵循的“编辑路径”上?