Custom progrebar-how to display the holo style in the 2.x system (the control style in the 4.x System)

Source: Internet
Author: User


Custom progrebar. Here, the progrebar (small) is used as an example to display the holo style in the 2.x system.

1) Find the System File styles. xml and themes. xml.

Find styles. xml and themes. XML in the directory ADT-bundle \ SDK \ platforms \ Android-19 \ data \ res \ values and open them with uedit;

2) Search for the Control name progrebar in styles. xml and find

"<Style name =" widget. holo. progressbar. Small "parent =" widget. progressbar. Small ">

<Item name = "Android: indeterminatedrawable"> @ Android: drawable/progress_small_holo </item>

</Style> ", where @ Android: drawable/progress_small_holo is an attribute;

3) Copy progress_small_holo and search "progress_small_holo" in the folder ADT-bundle \ SDK \ platforms \ Android-19 \ data \ res \ values \ drawable ",

Find the corresponding XML file and copy it to the drawable folder under Res of our own project (this folder should be created by yourself)

Note: If the property value is? Start with themes. XML, and repeat Step 3.

The content of the XML file is as follows:

<Layer-list xmlns: Android = "http://schemas.android.com/apk/res/android">

<Item>

<Rotate

Android: drawable = "@ drawable/spinner_16_outer_holo"

Android: Required Tx = "50%"

Android: Ty = "50%"

Android: fromdegrees = "0"

Android: todegrees = "1080"/>

</Item>

<Item>

<Rotate

Android: drawable = "@ drawable/spinner_16_inner_holo"

Android: Required Tx = "50%"

Android: Ty = "50%"

Android: fromdegrees = "720"

Android: todegrees = "0"/>

</Item>

</Layer-List>


4) modification error. Because the copied progress_small_holo contains an image, which must be copied to your project.

Search for image name spinner_16_outer_holo in adt-bundle-windows-x86-20130917 \ SDK \ platforms \ Android-18 \ data \ res \ drawable-hdpi,

And copy it to the drawable-hdpi folder in your project;

4) modify the control properties. Pull a smbar (small) control, set it to preview in 2. x system, and add

Android: indeterminatedrawable = "@ drawable/progress_small_holo ".


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.