Material Design Get Started

來源:互聯網
上載者:User


使用Material Design設計應用:


    Update Your App for the Android L Developer Preview

              為Android L 開發人員預覽版升級現有應用,你可以參考material design指導準則,來設計新的布局,通過觸摸反饋、UI動畫增強使用者體驗。


    Create New Apps for the Android L Developer Preview

              為Android L 開發人員預覽版新的應用,Material design指導準則為你的app提供了一個有凝聚力的設計架構,在你的app設計、開發中依從這些準則和新的功能。

    Apply the Material Theme

    在app中使用material theme,你必須在style聲明android:Theme.Material:


    <!-- res/values/styles.xml --><resources>  <!-- your app's theme inherits from the Material theme -->  <style name="AppTheme" parent="android:Theme.Material">    <!-- theme customizations -->  </style></resources>

        Material theme提供了新的系統widgets,可以在觸摸反饋、Activity切換中使用顏色調色盤和預設動畫。更多細節,參考Material Theme.

    Design Your Layouts

        除了使用或者自訂Material theme,你的布局必須和Material theme指導準則保持一致。當你設計應用時,請特意注意一下幾點:

      • Baseline grids
      • Keylines
      • Spacing
      • Touch target size
      • Layout structure

    Specify Elevation in Your Views

       視圖可以投射陰影,視圖的高程值決定了它的影子的大小和它繪製順序,在你的布局中可以設定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" />


        新的translationZ屬性,可以為view建立反映仰角臨時變化的動畫,這個對觸摸手勢是非常有用的。更多細節,請參考Views and Shadows.


    Use the New UI Widgets


        RecyclerView為ListView提高了顯示動態視圖效能,而且更加簡單易用。CardView是一個卡片


    視圖,可以在卡片內顯示資訊。可以使用下面的方式建立CardView。

        

    <android.support.v7.widget.CardView    android:id="@+id/card_view"    android:layout_width="200dp"    android:layout_height="200dp"    card_view:cardCornerRadius="3dp">    ...</android.support.v7.widget.CardView>

    更多細節請參考 UI Widgets.


    Customize Your Animations

        Android L 開發人員預覽版提供了新的apis,以支援建立自訂動畫。你可以建立activity的啟動過渡和退出過渡。


    // inside your activitygetWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);// set an exit transitiongetWindow().setExitTransition(new Explode());

           當你啟動另外的Activity時,退出transition 是啟用的。

        學習更多新特性,請參考:Animations.



    /*** @author 張興業*  http://blog.csdn.net/xyz_lmn*  我的新浪微博: @張興業TBOW*/


    參考:

    http://developer.android.com/preview/material/get-started.htm


    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.