標籤:android des style blog http java
使用Material Design設計應用:
- Take a look at the material design specification.
- Apply the material theme to your app.
- Define additional styles to customize the material theme.
- Create your layouts following material design guidelines.
- Specify the elevation of your views to cast appropriate shadows.
- Use the new widgets for complex views, such as lists and cards.
- Use the new APIs to customize the animations in your app.
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