Android monitors edittex pictures

In this paper, we share the method of edittex image monitoring for your reference. The specific contents are as follows

The first example: listen to the picture on the right of EditText

Obtain the rightmost x2 coordinate of EditText minus the X1 coordinate point of the rightmost picture. When the X coordinate of the click is between the two X's, the monitoring event will be executed

Second example:

We want to realize: when the text of EditText changes, we want to be notified, but unfortunately, Android does not have this listener, so we can't know the change, but we can use the textwatcher class to help us realize this function.

There is an EditText with id = edit.

1. Define an instance of textwatcher.

2. Register the textwatcher instance on EditText.

In this way, ontextchanged() will be called whenever the text of EditText changes!

The above is the monitoring event for Android EditText control. I hope it will be helpful to your learning and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>