TextView中的onClick不响应一个水龙头 [英] TextView onClick not responding to single tap
问题描述
我有一个的TextView
通过以下分配code:
I have a TextView
with the following assignment code:
Answer1TextView = (TextView) findViewById(R.id.editText1);
Answer1TextView.setOnClickListener(answer1TextViewListener);
和这里是我的onClickListener:
and here is my onClickListener:
private OnClickListener answer1TextViewListener = new OnClickListener()
{
public void onClick(View v)
{
if(Answer1Win){
Toast.makeText(QuizScreen.this,"Correct ",2).show();
} else
{
Toast.makeText(QuizScreen.this,"Incorrect, Pick Another Answer",2).show();
}
}
};
我的问题是一个吐司双击后只显示时间。我无法找到设置驱动器的这种行为,有什么可以设置错误的一个水龙头后不显示。
My problem is the Toast only is displayed after a double tap. I cannot find a setting the drives this behavior, what could be set wrong to not display after a single tap.
推荐答案
第一次单击只是将焦点设置到文本框,然后第二次点击实际上得到一个点击处理。而不是使用onClickListener,你可能有与<运气比较好href=\"http://developer.android.com/reference/android/view/View.html#setOnFocusChangeListener%28android.view.View.OnFocusChangeListener%29\">onFocusChangeListener
The first click just sets the focus to the TextBox then the second click actually gets handled as a click. Rather than using an onClickListener, you may have better luck with an onFocusChangeListener
这篇关于TextView中的onClick不响应一个水龙头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!