0
Button buttonClear;
private TextView inputValue;
private static final String DIGITS = ".";
private Boolean userIsInTheMiddleOfTypingANumber = false;
這裏是一些動畫在應用鍵盤 「數字」 2的TextView
TextView image1;
TextView image2;
TextView image3;
TextView image4;
TextView image5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
inputValue = (TextView) findViewById(R.id.ePrice);
findViewById(R.id.button0).setOnClickListener(this);
findViewById(R.id.button1).setOnClickListener(this);
findViewById(R.id.button2).setOnClickListener(this);
findViewById(R.id.button3).setOnClickListener(this);
findViewById(R.id.button4).setOnClickListener(this);
findViewById(R.id.button5).setOnClickListener(this);
findViewById(R.id.button6).setOnClickListener(this);
findViewById(R.id.button7).setOnClickListener(this);
findViewById(R.id.button8).setOnClickListener(this);
findViewById(R.id.button9).setOnClickListener(this);
findViewById(R.id.buttonDecimalPoint).setOnClickListener(this);
Button buttonClear = (Button) findViewById(R.id.buttonClear);
/** Backspace for in app keyboard */
buttonClear.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
inputValue.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_DEL));
}
});
/** Backspace */
/** Disable Key API level 11 where suppose to disable the android keybaord i also tried to change the manifest but the keyboard still coming up */
inputValue.setInputType(InputType.TYPE_NULL);
if (android.os.Build.VERSION.SDK_INT >= 11) {
inputValue.setRawInputType(InputType.TYPE_CLASS_TEXT);
inputValue.setTextIsSelectable(true);
}
image1 = (TextView)findViewById(R.id.tPercent);
image2 = (TextView)findViewById(R.id.textPercent);
image3 = (TextView)findViewById(R.id.Percent_10);
image4 = (TextView)findViewById(R.id.Percent_pay);
image5 = (TextView)findViewById(R.id.ePrice);
Animation animationFadeIn1 = AnimationUtils.loadAnimation(this, R.anim.fadein_1);
image1.startAnimation(animationFadeIn1);
Animation animationFadeIn2 = AnimationUtils.loadAnimation(this, R.anim.fadein_2);
image2.startAnimation(animationFadeIn2);
Animation animationFadeIn3 = AnimationUtils.loadAnimation(this, R.anim.fadein_3);
image3.startAnimation(animationFadeIn3);
Animation animationFadeIn4 = AnimationUtils.loadAnimation(this, R.anim.fadein_4);
image4.startAnimation(animationFadeIn4);
Animation animationFadeIn5 = AnimationUtils.loadAnimation(this, R.anim.shake);
image5.startAnimation(animationFadeIn5);
// here is first EditText which i can type normally which in app keyboard
final EditText editPrice = (EditText) findViewById(R.id.ePercents);
// here is second EditText where i can't type anything with in app keyboard
final EditText ePercent = (EditText) findViewById(R.id.ePrice);
// to get the 1 result
final TextView result = (TextView) findViewById(R.id.viewResult);
// to get the 2 result
final TextView result2 = (TextView) findViewById(R.id.viewResultPay);
Button buttonConvert = (Button) findViewById(R.id.buttonConvert);
buttonConvert.setOnClickListener(new OnClickListener() {
/**Here is some calculation happening **/
}
/**here is the onclick for buttons for in app keyboard**/
public void onClick(View v) {
/** Numbers */
String buttonPressed = ((Button) v).getText().toString();
if (DIGITS.contains(buttonPressed)) {
// digit was pressed
if (userIsInTheMiddleOfTypingANumber) {
if (buttonPressed.equals(".")
&& inputValue.getText().toString().contains(".")) {
} else {
inputValue.append(buttonPressed);
}
} else {
if (buttonPressed.equals(".")) {
inputValue.setText(0 + buttonPressed);
} else {
inputValue.setText(buttonPressed);
}
userIsInTheMiddleOfTypingANumber = true;
}
}
/** Numbers */
}
我想要的是:
要禁用Android鍵盤。
我需要在每個EditText中使用我製作的數字按鈕輸入EditText ..有2個EditText。
我試圖複製的onclick的數字,但它在同一時間在兩個EditText上的
得到任何幫助寫作。
我不想使用特定的數字...我有一個自制的數字鍵盤。 – user3051834
我想在第一個edittext中鍵入數字,然後在第二個中輸入數字,然後計算這些數字以獲得結果。而且我想用我的鍵盤不用安卓鍵盤來做到這一點。 – user3051834