Can you make an EditText input from right to left?

后端 未结 10 1170
天命终不由人
天命终不由人 2020-12-20 11:52

I was wondering if you can control input on an EditText to move from right to left? The EditText would have to support insert/delete etc. from right to left as well. Is th

10条回答
  •  [愿得一人]
    2020-12-20 12:48

    There is the manual way to do it by using the following code :

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
    
        if (keyCode == KeyEvent.KEYCODE_MENU) {
            // Each time click Menu button on the bar
            // Set the cursor to the first index
            mEtEmail.setSelection(0); // YOUR EDIT TEXT
        } 
    
        return super.onKeyUp(keyCode, event);
    }
    

    p/s : Or you can change

    KeyEvent.KEYCODE_MENU

    follow your wishes,

    Or you can try with Bidi.

    Thanks,

提交回复
热议问题