Android Material Design-Using the Material Theme (Using Material themes)-(2), materialandroid

Source: Internet
Author: User

Android Material Design-Using the Material Theme (Using Material themes)-(2), materialandroid

Reprinted please indicate the source:


The new material topic provides:

L allows you to set the system control of the palette.

L It is a control (designed) touch feedback animation.

L Activity transition Animation


You can control your customized material themes based on the color palette. You can also adjust the title Bar (Action Bar) and use the status Bar, 3, of the topic attribute.


The system controls are completely new in design and touch feedback animations. You can customize the color palette, touch feedback animation, and activity transition animation in the app.


The Material topic is defined as follows:

L @ android: style/Theme. Material (dark version)

L @ android: style/Theme. Material. Light (light version)

L @ android: style/Theme. Material. Light. DarkActionBar


For more available material styles, see the API reference of R. style.

Figure 1: dark material theme Figure 2: light material theme


Note:This material topic is only available in Android 5.0 (API level 21) and later versions. The v7 support Library provides Compatibility support for material theme styles and color palette of some controls. For more information, see Maintaining Compatibility (not updated ).


Custom palette

You need to define the basic color of the theme to adapt to your (app design) brand, and define your own color to use this color attribute in (material) Theme:


<resources> <!-- inherit from the material theme --> <style name="AppTheme"parent="android:Theme.Material">   <!-- Main theme colors -->    <!--  your app branding color for the app bar -->   <itemname="android:colorPrimary">@color/primary</item>   <!--   darker variant for thestatus bar and contextual app bars -->   <itemname="android:colorPrimaryDark">@color/primary_dark</item>   <!--   theme UI controls likecheckboxes and text fields -->   <itemname="android:colorAccent">@color/accent</item> </style></resources>


Custom Status Bar

With this material topic, you can easily customize the status bar, and you can also specify a color tone to adapt to your (app design) brand and provide sufficient contrast to display the white status bar icon. To customize the color of the status bar, you can use the android: statusBarColor attribute After inheriting the material topic. By default, the value of the android: statusBarColor attribute is android: colorPrimaryDark.

You can also define the format of the status bar. For example, if you want to display a transparent status bar on top of a photo, use a subtle dark gradient to make sure that the white status icon is visible. To do this, set the android: statusBarColor attribute to @ android: color/transparent (transparent) and adjust the window ID as needed. You can also use the Window. setStatusBarColor () method for animation or fading (fading ).

Figure 3: Custom material topic

Note: the status bar should always have a clear definition with the toolbar, unless you show the rich image or media content between the edge and the edge, (or you) the gradient ensures that the icon is still visible.



Personal suggestions on topics

The elements in the XML layout can also define the android: theme attribute, which is a reference topic resource. The topic element modified by this attribute and any child element are used to change the topic color palette in a special interface.


Demo effect:

Demo Source:


What does the material mean?

1. Materials and raw materials [C] [U]
Wood and stone are the only raw materials on the island.
Wood and stone are the only raw materials on the island.
2. fabric, material [C] [U]
3. Materials; materials [U] [(+ for)]
4. Tools and tools [P]
Your writing materials are in the top drawer

1. Material, tangible
A warm house and good food are material comforts.
Warm home and delicacies are material.
2. Physical, physical
3. [Law] The important [(+ to)] determines the decision and the key
A material witness failed to appear in court.
An important witness did not appear in court.

Material is different from the material.

Without the generic representation, the representation is used to indicate the materials mentioned above in the context. when the document is mentioned again later, the reader can be more specific; it is also often used to modify attributes.
Plastics is a material, the material can be recycled. Plastic is a material that can be recycled.
We're re prepared to accept the return of the rejected material within a week. we're going to accept the rejected material return within one week.

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: 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.