我有EditText
和Button
。
当您按EditText
时,我希望不显示keyboard
,当您按下Button
时,我想在EditText
上输入数字1。
观测
我希望cursor
不会消失。
![ When you press the 1 1 writes When you press the Del licked Can be controlled in the text Without the appearance of the keyboard ] 1
答案 0 :(得分:1)
Set this in your EditText xml to disable the keyboard
android:focusableInTouchMode="false"
Set a "1" on your edit text.
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mYourEditText.setText("1");
}
});
答案 1 :(得分:0)
Next configuration to your EditText
:
android:longClickable="false"
android:clickable="false"
android:focusableInTouchMode="false"
Add a onClickListener
to your button:
myButton.setOnClickListener(new View.OnCLickListener(){
@Override
public void onClick(View v) {
myEditText.setText( myEditText.getText().toString() + "1");
}
});