在执行的onclick明文视图值 [英] clear text view value while onclick is performed
本文介绍了在执行的onclick明文视图值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有明确的功能,但仍值不明确。可我知道如何解决这个问题呢?
I do have the clear function but still the value is not clear. May i know how to solve this problem ?
public class abc extends MenuActivity implements OnClickListener{
EditText et3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.safebox_flow);
et3 = (EditText)findViewById(R.id.EditText02);
et3.setText(String.valueOf('0'));
et3.setOnClickListener(this);
}
@Override
public void onClick(View v){
//Also here check the edittext02 id thats set in the xml layout
if(v.getId() == R.id.EditText02){
et3.setText("");
}
}
}
- 我要双击它不仅可以清除。
推荐答案
您code的下面部分进入onCreate方法。
The below part of your code goes into the onCreate method.
//Here make sure **EditText02** is the id that you have declared in XML
et3 = (EditText) findViewById(R.id.EditText02); //input type for edittext02 is number
et3.setOnClickListener(this);
public void onClick(View v){
//Also here check the edittext02 id thats set in the xml layout
if(v.getId() == R.id.EditText02){
et3.setText("");
}
}
此外,还要确保你的类实现OnClickListener
Also ensure that your class implements OnClickListener
//example below
public class MainActivity extends Activity implements OnClickListener {
请在下面发表评论,如果您仍然面临着问题。希望这有助于!
Please comment below if you still face problems. Hope this helps!
这篇关于在执行的onclick明文视图值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文