当前位置: 代码迷 >> Android >> android开发EditText有关问题
  详细解决方案

android开发EditText有关问题

热度:10   发布时间:2016-05-01 17:51:45.0
android开发EditText问题
EditText如何设置框内有文字提示,点击后,文字清除

 entryText.setOnTouchListener(new OnTouchListener() { 
  @Override
  public boolean onTouch(View v, MotionEvent event) {
  String str=entryText.getText().toString();
  if(str.equals("请输入文字")){
  entryText.setText("");
  }
  return false;
  }
  });


除此办法还有何种办法,求解救,求指点

------解决方案--------------------
在XML里面的

EditText里面加上:

android:hint="请输入文字"
------解决方案--------------------
楼上正解
  相关解决方案