Android官方面向开发者的材料设计外文翻译资料

 2023-01-14 13:10:28

http://developer.android.com/training/material/index.html.

(Android官方面向开发者的材料设计)

原文:

Material Design for Developers

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. To use material design in your Android apps, follow the guidelines described in the material design specification and use the new components and functionality available in Android 5.0 (API level 21).

This class shows you how to create material design apps with the following elements:

  • The material theme
  • Widgets for cards and lists
  • Custom shadows and view clipping
  • Vector drawables
  • Custom animations

This class also teaches you how to maintain compatibility with versions of Android earlier than 5.0 (API level 21) when you use material design features in your app.

Getting Started

To create apps with material design:

  1. Review the material design specification.
  2. Apply the material theme to your app.
  3. Create your layouts following material design guidelines.
  4. Specify the elevation of your views to cast shadows.
  5. Use system widgets for lists and cards.
  6. Customize the animations in your app.

Maintain backward compatibility

You can add many material design features to your app while maintaining compatibility with versions of Android earlier than 5.0. For more information, see Maintaining Compatibility.

Update your app with material design

To update an existing app to incorporate material design, update your layouts following material design guidelines. Also make sure to incorporate depth, touch feedback, and animations.

Create new apps with material design

If you are creating a new app with material design features, the material design guidelines provide you with a cohesive design framework. Follow those guidelines and use the new functionality in the Android framework to design and develop your app.

Apply the Material Theme

To apply the material theme in your app, specify a style that inherits from android:Theme.Material:

lt;!-- res/values/styles.xml --gt;

lt;resourcesgt;

lt;!-- your theme inherits from the material theme --gt;

lt;style name='AppTheme' parent='android:Theme.Material'gt;

lt;!-- theme customizations --gt;

lt;/stylegt;

lt;/resourcesgt;

The material theme provides updated system widgets that let you set their color palette and default animations for touch feedback and activity transitions. For more details, see Using the Material Theme.

Design Your Layouts

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

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

Specify Elevation in Your Views

Views can cast shadows, and the elevation value of a view determines the size of its shadow and its drawing order. To set the elevation of a view, use the android:elevation attribute in your layouts:

lt;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' /gt;

The new translationZ property lets you create animations that reflect temporary changes in the elevation of a view. Elevation changes can be useful when responding to touch gestures.

For more details, see Defining Shadows and Clipping Views.

Create Lists and Cards

RecyclerView is a more pluggable version of ListView that supports different layout types and provides performance improvements. CardView lets you show pieces of information inside cards with a consistent look across apps. The following code example demonstrates how to include a CardView in your layout:

lt;android.support.v7.widget.CardView

android:id='@ id/card_view'

android:layout_width='200dp'

android:layout_height='200dp'

card_view:cardCornerRadius='3dp'gt;

...

lt;/android.support.v7.widget.CardViewgt;

For more information, see Creating Lists and Cards.

Customize Your Animations

Android 5.0 (API level 21) includes new APIs to create custom animations in your app. For example, you can enable activity transitions and define an exit transition inside an activity:

public class MyActivity extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

// enable transitions

getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);

setContentView(R.layout.activity_my);

}

public void onSomeButtonClicked(View view) {

getWindow().setExitTransition(new Explode());

Intent intent = new Intent(this, MyOtherActivity.class);

startActivity(intent,

ActivityOptions

.makeScene

剩余内容已隐藏,支付完成后下载完整资料


http://developer.android.com/training/material/index.html.

(Android官方面向开发者的材料设计)

原文:

Material Design for Developers

Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices. To use material design in your Android apps, follow the guidelines described in the material design specification and use the new components and functionality available in Android 5.0 (API level 21).

This class shows you how to create material design apps with the following elements:

  • The material theme
  • Widgets for cards and lists
  • Custom shadows and view clipping
  • Vector drawables
  • Custom animations

This class also teaches you how to maintain compatibility with versions of Android earlier than 5.0 (API level 21) when you use material design features in your app.

Getting Started

To create apps with material design:

  1. Review the material design specification.
  2. Apply the material theme to your app.
  3. Create your layouts following material design guidelines.
  4. Specify the elevation of your views to cast shadows.
  5. Use system widgets for lists and cards.
  6. Customize the animations in your app.

Maintain backward compatibility

You can add many material design features to your app while maintaining compatibility with versions of Android earlier than 5.0. For more information, see Maintaining Compatibility.

Update your app with material design

To update an existing app to incorporate material design, update your layouts following material design guidelines. Also make sure to incorporate depth, touch feedback, and animations.

Create new apps with material design

If you are creating a new app with material design features, the material design guidelines provide you with a cohesive design framework. Follow those guidelines and use the new functionality in the Android framework to design and develop your app.

Apply the Material Theme

To apply the material theme in your app, specify a style that inherits from android:Theme.Material:

lt;!-- res/values/styles.xml --gt;

lt;resourcesgt;

lt;!-- your theme inherits from the material theme --gt;

lt;style name='AppTheme' parent='android:Theme.Material'gt;

lt;!-- theme customizations --gt;

lt;/stylegt;

lt;/resourcesgt;

The material theme provides updated system widgets that let you set their color palette and default animations for touch feedback and activity transitions. For more details, see Using the Material Theme.

Design Your Layouts

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

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

Specify Elevation in Your Views

Views can cast shadows, and the elevation value of a view determines the size of its shadow and its drawing order. To set the elevation of a view, use the android:elevation attribute in your layouts:

lt;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' /gt;

The new translationZ property lets you create animations that reflect temporary changes in the elevation of a view. Elevation changes can be useful when responding to touch gestures.

For more details, see Defining Shadows and Clipping Views.

Create Lists and Cards

RecyclerView is a more pluggable version of ListView that supports different layout types and provides performance improvements. CardView lets you show pieces of information inside cards with a consistent look across apps. The following code example demonstrates how to include a CardView in your layout:

lt;android.support.v7.widget.CardView

android:id='@ id/card_view'

android:layout_width='200dp'

android:layout_height='200dp'

card_view:cardCornerRadius='3dp'gt;

...

lt;/android.support.v7.widget.CardViewgt;

For more information, see Creating Lists and Cards.

Customize Your Animations

Android 5.0 (API level 21) includes new APIs to create custom animations in your app. For example, you can enable activity transitions and define an exit transition inside an activity:

public class MyActivity extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

// enable transitions

getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);

setContentView(R.layout.activity_my);

}

public void onSomeButtonClicked(View view) {

getWindow().setExitTransition(new Explode());

Intent intent = new Intent(this, MyOtherActivity.class);

startActivity(intent,

ActivityOptions

.makeScene

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[153909],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

课题毕业论文、外文翻译、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。