Android studio EditText click the icon to clear the instance resolution of text content

This article is a function enhancement after customizing EditText style. It has great reference opinions for practical application projects. Interested friends can move to the previous article, "customizing EditText style for Android study". The specific function code for clearing EditText content is as follows:

The custom myedittext class is actually the same as the EditText control we dragged in the layout file, because myedittext inherits from the parent class EditText. However, when we call in the layout file, we should include the full package name, as follows:

Attached are actual renderings:

After careful observation, it can be found that the empty Icon of the first input box leans a little to the left because I added a line of code Android: paddingright = "10dp" in the XML layout file of the first input box. In this way, we can adjust the position of the empty Icon according to the resolution of the mobile phone

Icon material:

The above is the Android studio EditText introduced by Xiaobian. Click the icon to clear the text content. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

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
分享
二维码
< <上一篇
下一篇>>