Android development realizes the method of clicking the button to switch the background and modify the text color

This paper describes the method of clicking the button to switch the background and modify the text color in Android development. Share with you for your reference, as follows:

In fact, the principle is very simple. The selector is used to set the properties of Android: background and Android: textcolor. The selector can be used to set the properties of background image and text color at default and click. The process is as follows:

The two documents are as follows:

1. When clicking the button, change the color of the text:

2. When clicking the button, change the background of the button:

Is it very simple? You don't need to use java code to set it. You just need to set it to the textview or button you need, as follows:

Successfully completed!!!!

More readers interested in Android related content can view the special topics of this site: summary of Android graphics and image processing skills, introduction and advanced tutorial of Android development, summary of Android debugging skills and common problem solving methods, summary of Android basic component usage, summary of Android view skills, summary of Android layout skills, and Android control usage summary

I hope this article will help you in Android programming.

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