介于拟物和扁平之间的Material Design自面世以来,便引起了很多人的关注与思考,就此产生的讨论也不绝于耳。本文详细介绍了在Android开发者圈子里颇受青睐的十个Material Design开源项目,从示例、FAB、菜单、动画、Ripple到Dialog,看被称为“Google第一次在设计语言和规范上超越了Apple”的Material Design是如何逐渐成为App的一种全新设计标准。
1. MaterialDesignLibrary 在众多新晋库中,MaterialDesignLibrary可以说是颇受开发者瞩目的一个控件效果库,能够让开发者在Android 2.2系统上使用Android 5.0才支持的控件效果,比如扁平、矩形、浮动按钮,复选框以及各式各样的进度指示器等。 
除上述之外,MaterialDesignLibrary还拥有SnackBar、Dialog、Color selector组件,可非常便捷地对应用界面进行设置。
进度指示器样式效果设置: - <com.gc.materialdesign.views.ProgressBarCircularIndetermininate
- android:id="@+id/progressBarCircularIndetermininate"
- android:layout_width="32dp"
- android:layout_height="32dp"
- android:background="#1E88E5" />
Dialog:
- Dialog dialog = new Dialog(Context context,String title, String message);
- dialog.show();
2. RippleEffect 由来自法兰西的Robin Chutaux开发的RippleEffect基于MIT许可协议开源,能够在Android API 9+上实现Material Design,为开发者提供了一种极为简易的方式来创建带有可扩展视图的header视图,并且允许最大程度上的自定制。 
用法(在XML文件中声明一个RippleView): - <com.andexert.library.RippleView
- android:id="@+id/more"
- android:layout_width="?android:actionBarSize"
- android:layout_height="?android:actionBarSize"
- android:layout_toLeftOf="@+id/more2"
- android:layout_margin="5dp"
- ripple:rv_centered="true">
-
- <ImageView
- android:layout_width="?android:actionBarSize"
- android:layout_height="?android:actionBarSize"
- android:src="@android:drawable/ic_menu_edit"
- android:layout_centerInParent="true"
- android:padding="10dp"
- android:background="@android:color/holo_blue_dark"/>
-
- </com.andexert.library.RippleView>
3. MaterialEditText 随着Material Design的到来,AppCompat v21也为开发者提供了Material Design的控件外观支持,其中就包括EditText,但却并不好用,没有设置颜色的API,也没有任何Google Material Design Spec中提到的特性。于是,来自国内的开发者“扔物线”开发了MaterialEditText库,直接继承EditText,无需修改Java文件即能实现自定义控件颜色。 
自定义Base Color: 
自定义Error Color: - app:maxCharacters="10"
- app:errorColor="#ddaa00"

|