A guide to the related processing of pictures in the material design of Android applications _android

Source: Internet
Author: User

Scalable Vector pictures do not lose sharpness, and a single color of App-icon is perfect
You can define a bitmap as transparency (Alpha) and run time colors
You can take a color from a bitmap image and remove its more conspicuous color.
Website address: https://developer.android.com/training/material/drawables.html

The following image features can help you implement material design in app:

    • Picture coloring
    • Color extraction
    • Vector pictures

Tint drawable Resources for image resource coloring

At the Android 5.0 (API level 21) and above, you can define images and 9-patch as masking transparency. You can use color resources (such as,? android:attr/colorprimary) or theme properties to paint them. Typically, you only need to create these resources once, and automatically match your theme to color them.
You can dye bitmapdrawable and ninepatchdrawable objects using settint (int tint). You can also define the Android:tint and Android:tintmode properties in XML.
• for settint (int tint) parameters, can be a @color/under a property, or can be an XML selector,selector the item is used numerically, such as:

 <selector xmlns:android= "Http://schemas.android.com/apk/res/android" >
  <item android:state_focused= " True "android:color=" @color/testcolor1 "/>
  <item android:state_pressed=" true "android:state_enabled=" False "android:color=" @color/testcolor2 "/>
  <item android:state_enabled=" false "android:color=" @color/ Testcolor3 "/>
  <item android:color=" @color/testcolor5 "/>
 </selector>

• Define attributes in XML, such as:

<?xmlversion= "1.0" encoding= "Utf-8"?> <nine-patchxmlns:android=
"Http://schemas.android.com/apk/res" /android " 
  android:tint=" @color/abc_primary_text_material_light " 
  android:tintmode=" Src_over "
  ... >
</nine-patch>

Extract prominent Colors from image extract the obvious color from the picture
there is a android-support-v7-palette.jar in the SUPPORT-V7 library on the api21 that allows you to extract some conspicuous colors from the picture:

Palette p = palette.generate (Bitmap Bitmap);
    • Bright P.getvibrantcolor (int defaultcolor);
    • Bright Dark P.getdarkvibrantcolor (int defaultcolor);
    • Brightly bright p.getlightvibrantcolor (int defaultcolor);
    • Soft P.getmutedcolor (int defaultcolor);
    • Soft dark P.getdarkmutedcolor (int defaultcolor);
    • Soft bright P.getlightmutedcolor (int defaultcolor);

Palette.generate (), for execution in a background thread, and if you create a Palette object in the foreground thread, you can use Palette.generateasync ().

Create vector drawables creating vectors picture
in the Android 5.0 (API level 21) and above you can create vector images, such as the following example to draw a heart-shaped vector diagram:

<!--res/drawable/heart.xml-->
<vector xmlns:android= "Http://schemas.android.com/apk/res/android"
  <!--intrinsic size of the drawable-->
  android:height= "256DP"
  android:width= "256DP"
  <!-- Size of the virtual canvas-->
  android:viewportwidth= "android:viewportheight="
  >

 <!-- Draw a path-->
 <path android:fillcolor= "#8fff android:pathdata=" m20.5,9.5 c-1.955,0,-
            3.83,1.268,-4.5,3
            c-0.67,-1.732,-2.547,-3,-4.5,-3
            c8.957,9.5,7,11.432,7,14
            C0, 3.53,3.793,6.257,9,11.5
            c5.207,-5.242,9,-7.97,9,-11.5
            c25,11.432,23.043,9.5,20.5,9.5z "/>
</vector>

Vector pictures use vectordrawble objects in Android to match them. For more information on path, see: Http://www.w3.org/TR/SVG11/paths.html#PathData.

Design Standard Examples

Choose pictures

Describe specific things and use photos first. You can then consider using illustrations.
The text on the picture

The text on the picture requires a faint mask to make it readable. The dark mask is transparent between 20%-40%, with a light-colored matte opacity between 40%-60%.

For large pictures with text, mask the text area, do not cover the entire picture.

You can use a translucent main color to cover the picture.
Extract Color

Android L can extract the primary color from the picture and use it on other UI elements.
Picture loading process

The picture loading process is very fastidious, the transparency, the exposure degree, the saturation degree 3 index changes sequentially, the effect is quite exquisite.

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.