Android Material Design-Using the Material Theme (use the Material topic)-(2)

Source: Internet
Author: User

Android Material Design-Using the Material Theme (use the Material topic)-(2)


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:



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:





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.