Android (lollipop/5.0) Material Design (ii) Getting Started Guide

Source: Internet
Author: User

Website address: https://developer.android.com/intl/zh-tw/training/material/get-started.html

Apply the Material Theme material theme

<!--res/values/styles.xml --<resources>  <!--your theme inherits from the material theme -  <style name="Apptheme" Parent="Android:Theme.Material">    <!--Theme Customizations -  </style></resources>
Design Your Layouts Designing your layout

in addition to applying and customizing the material theme, your layout should conform to the material design guidelines. When you design your layout , you need to pay special attention to the following :

Baseline grid

Keylines

Spacing

Touch Target Size

Layout structure

Specify elevation in Your viewsspecifying the Elevation property in viewView can cast a shadow, the elevation value of a view determines its shadow size and the order in which it is drawn. You can set the elevation of a view, inuse in layoutsProperties: Android:elevation

<textview    Android:id="@+id/my_textview"    Android:layout_width="Wrap_content"    Android:layout_height="Wrap_content"    Android:text="@string/next"    Android:background="@color/white"    android:elevation="5DP" />
The new Translationz property enables you to create an animation that reflects a transient elevation change. Elevation'sChangecan be inResponsemay be useful when touching gestures.

Customize Your Animations Custom animations can be customized animations, such as animating transition animations and ending transitions animations for activity

 Public class myactivity extends Activity {    @Override    protected voidonCreate(Bundlesavedinstancestate) {        Super.onCreate(savedinstancestate);        //Enable TransitionsGetWindow().requestfeature(Window.feature_content_transitions);Setcontentview(R.Layout.activity_my);    }     Public voidonsomebuttonclicked(ViewView) {GetWindow().setexittransition(New Explode());        IntentIntent= New Intent( This, myotheractivity.class);startactivity(Intent,                      activityoptions                          .makescenetransitionanimation( This).Tobundle());    }}
When you start other activity in this activity, exit transition will be activated


Android (lollipop/5.0) Material Design (ii) Getting Started Guide

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.