edittextで、「Enter」キーを入力した後、システムはその中に新しい行を作成します。次のエディットテキストに焦点を当てたいのですが、新しい行はありません。コーディング方法は?xmlの私のコードは以下のとおりです
<EditText
android:id="@+id/txtNPCode"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:layout_alignLeft="@+id/lblNPCode"
android:layout_below="@+id/lblNPCode"
android:layout_centerHorizontal="true"/>
<EditText
android:id="@+id/txtCNPCode"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:layout_alignLeft="@+id/lblCNPCode"
android:layout_below="@+id/lblCNPCode"
android:layout_centerHorizontal="true"/>
setOnKeyListenerのキーコードもキャプチャします
tCNPCode.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if(keyCode == 66) {
Toast.makeText(S_PCode.this, "Enter Key", Toast.LENGTH_LONG).show();
//tNPCode.setFocusable(true);
}
return false;
}
});