Change the default style of the android Control

Source: Internet
Author: User

Android spatial styles mainly include background images or colors in various states of the control, and the font color in the control.

Here, I want to explain what a status means. The controls in android have the following states:
Normal
Whether state_enabled is valid
State_focused focus?
Whether state_pressed is pressed
Among them, state_focused and state_pressed can be freely combined into the following four types:

Android: state_focused = "true" android: state_pressed = "true"
Android: state_focused = "true" android: state_pressed = "false"
Android: state_focused = "false" android: state_pressed = "true"
Android: state_focused = "false" android: state_pressed = "false"

It can be seen that the android control has many different States and different styles in different states, such as different backgrounds. Please note that the background of the android control is mostly represented by images.

In addition, the controls in android have two modes on the screen:

1 Normal Mode
2. Touch Mode

In normal mode when the control is displayed, the control is automatically switched to touch mode when you touch the screen with your fingers, after you exit the screen, you can use the trackball or arrow keys to switch to the normal mode. Please note that you may encounter problems during the switching process. For example, rolling the trackball after you exit the screen is invalid, you can also click "no response" when you use the screen again. This should be a disadvantage of android and should be noted during programming.

In these two modes, the States mentioned above have different performances. In normal mode, you must select them before pressing them, but in touchmode, they are not required, the responses to user operations are different.


What is the style of the control? This includes a lot of controls, including the control size, background, foreground, whether it can be selected, click, and so on.
For example, if the selected listview is black by default, it will be highlighted in yellow. Many friends will definitely want to change it. Is there any way.
The answer is yes, but you need to define a new style, that is, style, and then use the custom style when using the control.

After our tests, most of the control styles can be customized, but a few of them are not feasible. For example, the background of the menu cannot be changed during the tabActivity label header selection, because their background images are hard-coded into the system and cannot be set through the interface, but there is a way to bypass the menu, that is, the system menu is not used at all. We can intercept the menu button event, implement your own menu in the listener.

Author "ljbal"
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.