使用TextSwitcher
自動移動Text Field
,移動的很正常但是光標的焦點很遲鈍。到了下一個的是很,焦點還停在上一個。
public void textWatcher(){
pin.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
if(pin.getText().toString().length()==1)
{
pin2.requestFocus();
pin.clearFocus();
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
}
謝謝!
public void textWatcher(){ pPin1.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
if(pPin1.getText().toString().length()==1)
{
pPin2.requestFocus();
}
// TODO Auto-generated method stub
}
}); }
解決了吧