I am trying to prefill an EditText widget with some instr. but erase the moment the user clicks in the box so they star开发者_JAVA百科t leftmost point? I tried registering onClickListener(), onKeyListener but I was not able to capture this? Thanks What can I register to detect this first click within the text editing area?
This can be done without listening for an event. In your EditText element in your layout.xml file, you can set an attribute android:hint.
<EditText
android:hint="Write Caption" <!-- This line -->
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Maybe you should try using a focus listener.
EDIT: try http://developer.android.com/reference/android/widget/TextView.html#onWindowFocusChanged(boolean) or http://developer.android.com/reference/android/view/View.OnFocusChangeListener.html
精彩评论