Material Design中全新的动画

简介:

Material Design中的动画将为用户提供操作反馈并在用户与您的应用进行互动时提供视觉连续性。 Material Design将为按钮与操作行为转换提供一些默认动画,而 Android 5.0(API Level 21)及更高版本可让您定制这些动画,同时也可创建新动画:

一、触摸反馈动画

效果图:

Material Design的触摸反馈可在用户与 UI 元素互动时,在接触点上提供即时视觉确认。 适用于按钮的默认触摸动画使用全新 RippleDrawable类别,以波纹效果实现不同状态间的转换。

在大多数情况下,应以下列方式指定视图背景,在您的视图 XML 中应用此功能:

  • android:attr/selectableItemBackground 指定有界的波纹。
  • android:attr/selectableItemBackgroundBorderless 指定越过视图边界的波纹。 它将由一个非空背景的视图的最近父项所绘制和设定边界。

任何view处于可点击状态,都可以使用RippleDrawable来达到水波纹特效,而且必须处于可点击状态,才会出现波纹动画效果。

在代码中可以这样设置:

注意:selectableItemBackgroundBorderless是 API Level 21 中推出的新属性。

此外,您可利用 ripple元素将 RippleDrawable定义为一个 XML 资源。

您可以为 RippleDrawable对象指定一种颜色。如果要改变默认触摸反馈颜色,请使用主题的 android:colorControlHighlight属性。

如果要了解更多信息,请参阅 RippleDrawable类别的 API 参考文档。

我们来看看系统自带的触摸反馈动画是怎么实现的,为什么只需要在view的background或者foreground属性设置成?android:attr/selectableItemBackground或者?android:attr/selectableItemBackgroundBorderless就可以实现波纹动画的效果?这两个属性点进去,可以看到在路径sdk/platforms/android-xx/data/res/values/attrs.xml文件中有定义这么两个属性:

 
 
  1. <!-- Background drawable for bordered standalone items that need focus/pressed states. --> 
  2.  
  3. <attr name="selectableItemBackground" format="reference" /> 
  4.  
  5. <!-- Background drawable for borderless standalone items that need focus/pressed states. --> 
  6.  
  7. <attr name="selectableItemBackgroundBorderless" format="reference" />  

我们想到,这两个属性既然是整个app中有效的,那可能会是在Theme中的属性吧,那就去AndroidManifest文件中跟这个Theme一步步看下去,最后在Base.V21.Theme.AppCompat.Light这个style中看到确实是有这两个item属性:

 
 
  1. <item name="selectableItemBackground">?android:attr/selectableItemBackground</item> 
  2.  
  3. <item name="selectableItemBackgroundBorderless">?android:attr/selectableItemBackgroundBorderless</item>  

但是这里还是调用的系统的定义的属性,继续往下追,在android:Theme.Material和android:Theme.Material.Light中,可以看到:

 
 
  1. <item name="selectableItemBackground">@drawable/item_background_material</item> 
  2.  
  3. <item name="selectableItemBackgroundBorderless">@drawable/item_background_borderless_material</item>  

然后sdk路径下platforms\\android-xx\\data\\res\\drawable可以找到这些资源文件如下图:

item_background_material的内容是:

 
 
  1. <ripple xmlns:android="http://schemas.android.com/apk/res/android" 
  2.  
  3.     android:color="?attr/colorControlHighlight"
  4.  
  5.     <item android:id="@id/mask"
  6.  
  7.         <color android:color="@color/white" /> 
  8.  
  9.     </item> 
  10.  
  11. </ripple>  

item_background_borderless_material的内容是:

 
 
  1. <ripple xmlns:android="http://schemas.android.com/apk/res/android" 
  2.  
  3.     android:color="?attr/colorControlHighlight" />  

系统的做法是用ripple元素将 RippleDrawable定义为一个 XML 资源,而通过看View的源码中在构造方法中是这样获取background属性的:

 
 
  1. public View(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { 
  2.  
  3.         this(context); 
  4.  
  5.  
  6.         final TypedArray a = context.obtainStyledAttributes( 
  7.  
  8.                 attrs, com.android.internal.R.styleable.View, defStyleAttr, defStyleRes); 
  9.  
  10.  
  11.         if (mDebugViewAttributes) { 
  12.  
  13.             saveAttributeData(attrs, a); 
  14.  
  15.         } 
  16.  
  17.  
  18.         Drawable background = null
  19.  
  20.  
  21.         switch (attr) { 
  22.  
  23.             case com.android.internal.R.styleable.View_background: 
  24.  
  25.                 background = a.getDrawable(attr); 
  26.  
  27.                 break; 
  28.  
  29.         . 
  30.  
  31.         . 
  32.  
  33.         . 
  34.  
  35.  

也就是说,这个background实际上就是RippleDrawable类。那我们就来看看这个RippleDrawable内部到底是怎么做的吧。

首先官方文档对RippleDrawable解释是

Drawable that shows a ripple effect in response to state changes. The anchoring position of the ripple for a given state may be specified by calling setHotspot(float, float)with the corresponding state attribute identifier.

通过显示出波纹效果来响应状态的改变,对于给定状态的波纹的锚定位置可以通过调用具有对应的状态属性标识符的setHotspot(float,float)来指定。

RippleDrawable继承自LayerDrawable,而LayerDrawable是继承Drawable,RippleDrawable又是为了响应View的statechange,那就看看Drawable类中对点击时的状态处理吧。

 
 
  1. public boolean setState(@NonNull final int[] stateSet) { 
  2.  
  3.     if (!Arrays.equals(mStateSet, stateSet)) { 
  4.  
  5.         mStateSet = stateSet; 
  6.  
  7.         return onStateChange(stateSet); 
  8.  
  9.     } 
  10.  
  11.     return false
  12.  
  13.  

给Drawable设置状态属性时,会把状态的数组传给onStateChange方法,在RippleDrawable中重写了onStateChange。

看到setRippleActive和setBackgroundActive这两个方法应该可以猜到是什么意思了,接着看。

 
 
  1. private void setRippleActive(boolean active) { 
  2.  
  3.     if (mRippleActive != active) { 
  4.  
  5.         mRippleActive = active; 
  6.  
  7.         if (active) { 
  8.  
  9.             tryRippleEnter(); 
  10.  
  11.         } else { 
  12.  
  13.             tryRippleExit(); 
  14.  
  15.         } 
  16.  
  17.     } 
  18.  
  19.  

如果Drawable是enable=true且pressd=true时,会调用tryRippleEnter方法

看到这里,我们可以知道要开始做波纹动画的效果了。mRipple 是RippleForeground类的实例,然而我没有在RippleForeground类中找到setup和enter方法,但是RippleForeground继承自RippleComponent类,于是,我在这个类中发现了这两个方法。

 
 
  1. public final void setup(float maxRadius, int densityDpi) { 
  2.  
  3.     if (maxRadius >= 0) { 
  4.  
  5.         mHasMaxRadius = true
  6.  
  7.         mTargetRadius = maxRadius; 
  8.  
  9.     } else { 
  10.  
  11.         mTargetRadius = getTargetRadius(mBounds); 
  12.  
  13.     } 
  14.  
  15.  
  16.     mDensityScale = densityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE; 
  17.  
  18.  
  19.     onTargetRadiusChanged(mTargetRadius); 
  20.  
  21.  

setup是初始化一系列参数,enter创建一个动画并开始动画。

从上面创建动画的代码可以看到,实际上是一个组合的属性动画,然后自定义了三个属性波纹半径TWEEN_RADIUS、波纹中心点TWEEN_ORIGIN和波纹的不透明度OPACITY。通过这三个属性的过渡变化得到一个复合的动画。以上就是前景波纹动画效果的实现过程。

 
 
  1. private void setBackgroundActive(boolean active, boolean focused) { 
  2.  
  3.     if (mBackgroundActive != active) { 
  4.  
  5.         mBackgroundActive = active; 
  6.  
  7.         if (active) { 
  8.  
  9.             tryBackgroundEnter(focused); 
  10.  
  11.         } else { 
  12.  
  13.             tryBackgroundExit(); 
  14.  
  15.         } 
  16.  
  17.     } 
  18.  
  19.  

mBackground是RippleBackground类的实例,与RippleForeground不同的是,背景动画只是改变了不透明度。

 
 
  1. @Override 
  2.  
  3. protected Animator createSoftwareEnter(boolean fast) { 
  4.  
  5.     // Linear enter based on current opacity. 
  6.  
  7.     final int maxDuration = fast ? OPACITY_ENTER_DURATION_FAST : OPACITY_ENTER_DURATION; 
  8.  
  9.     final int duration = (int) ((1 - mOpacity) * maxDuration); 
  10.  
  11.  
  12.     final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 1); 
  13.  
  14.     opacity.setAutoCancel(true); 
  15.  
  16.     opacity.setDuration(duration); 
  17.  
  18.     opacity.setInterpolator(LINEAR_INTERPOLATOR); 
  19.  
  20.  
  21.     return opacity; 
  22.  
  23.  

以上分析的都是手指触摸view时产生的enter波纹动画,当手指抬起时state也会改变,会产生一个exit动画,这里就不详细分析了。

二、使用揭露效果

效果图:

当需要显示或隐藏一组UI元素时,揭露动画可为用户提供视觉连续性。

 
 
  1. /* @param view The View will be clipped to the animating circle.要隐藏或显示的view 
  2.  
  3.  * @param centerX The x coordinate of the center of the animating circle, relative to <code>view</code>.动画开始的中心点X 
  4.  
  5.  * @param centerY The y coordinate of the center of the animating circle, relative to <code>view</code>.动画开始的中心点Y 
  6.  
  7.  * @param startRadius The starting radius of the animating circle.动画开始半径 
  8.  
  9.  * @param endRadius The ending radius of the animating circle.动画结束半径 
  10.  
  11.  */ 
  12.  
  13. public static Animator createCircularReveal(View view
  14.  
  15.         int centerX,  int centerY, float startRadius, float endRadius) { 
  16.  
  17.     return new RevealAnimator(view, centerX, centerY, startRadius, endRadius); 
  18.  
  19.  

RevealAnimator和之前的动画使用没什么区别,同样可以设置监听器和加速器来实现各种各样的特效,该动画主要用在隐藏或者显示一个view,改变view的大小等过渡效果。

显示view:

 
 
  1. final TextView tv9 = (TextView) findViewById(R.id.tv9); 
  2.  
  3.  
  4. findViewById(R.id.content_main).setOnClickListener(new View.OnClickListener() { 
  5.  
  6.     @Override public void onClick(View v) { 
  7.  
  8.         // get the center for the clipping circle 
  9.  
  10.         int cx = (tv9.getRight() - tv9.getLeft()) / 2; 
  11.  
  12.         int cy = (tv9.getBottom() - tv9.getTop()) / 2; 
  13.  
  14.  
  15.         // get the final radius for the clipping circle 
  16.  
  17.         int finalRadius = Math.max(tv9.getWidth(), tv9.getHeight()); 
  18.  
  19.  
  20.         // create the animator for this view (the start radius is zero) 
  21.  
  22.         final Animator anim = ViewAnimationUtils.createCircularReveal(tv9, cx, cy, 0, finalRadius); 
  23.  
  24.  
  25.         tv9.setVisibility(View.VISIBLE); 
  26.  
  27.  
  28.         anim.start(); 
  29.  
  30.     } 
  31.  
  32. });  

隐藏view:

 
 
  1. final TextView tv9 = (TextView) findViewById(R.id.tv9); 
  2.  
  3.  
  4. tv9.setOnClickListener(new View.OnClickListener() { 
  5.  
  6.     @Override public void onClick(View v) { 
  7.  
  8.         // get the center for the clipping circle 
  9.  
  10.         int cx = (tv9.getRight() - tv9.getLeft()) / 2; 
  11.  
  12.         int cy = (tv9.getBottom() - tv9.getTop()) / 2; 
  13.  
  14.  
  15.         // get the final radius for the clipping circle 
  16.  
  17.         int initRadius = Math.max(tv9.getWidth(), tv9.getHeight()); 
  18.  
  19.  
  20.         // create the animator for this view (the start radius is zero) 
  21.  
  22.         final Animator anim = ViewAnimationUtils.createCircularReveal(tv9, cx, cy, initRadius, 0); 
  23.  
  24.  
  25.         anim.addListener(new AnimatorListenerAdapter() { 
  26.  
  27.             @Override public void onAnimationEnd(Animator animation) { 
  28.  
  29.                 super.onAnimationEnd(animation); 
  30.  
  31.                 // make the view visible and start the animation 
  32.  
  33.                 tv9.setVisibility(View.INVISIBLE); 
  34.  
  35.             } 
  36.  
  37.         }); 
  38.  
  39.         anim.start(); 
  40.  
  41.     } 
  42.  
  43. });  

沿着中心缩小:

 
 
  1. Animator animator = ViewAnimationUtils.createCircularReveal(viewview.getWidth() / 2, view.getHeight() / 2, view.getWidth(), 0); 
  2.  
  3. animator.setInterpolator(new LinearInterpolator()); 
  4.  
  5. animator.setDuration(1000); 
  6.  
  7. animator.start();  

从左上角扩展:

 
 
  1. Animator animator = ViewAnimationUtils.createCircularReveal(view,0,0,0,(float) Math.hypot(view.getWidth(), view.getHeight())); 
  2.  
  3. animator.setDuration(1000); 
  4.  
  5. animator.start();  

三、使用转场动画

效果图以共享元素的转场动画为例:

MaterialDesign应用中的操作行为转换透过通用元素之间的移动和转换提供不同状态之间的视觉连接。可为进入、退出转换以及操作行为之间的共享元素转换指定定制动画。在5.0之前,我们可以在startActivity之后调用overridePendingTransition来指定Activity的转场动画。

  • 进入转换将决定操作行为中视图如何进入场景。例如,在分解进入转换中,视图将从屏幕外进入场景并飞往屏幕中心。
  • 退出转换将决定操作行为中应用行为的显示视图如何退出场景。例如,在分解退出转换中,视图将从屏幕中心退出场景。
  • 共享元素转换将决定两个操作行为转换之间共享的视图如何在这些操作行为中转换。 例如,如果两个操作行为拥有相同的图像,但其位置与大小不同,changeImageTransform共享元素转换将在这些操作行为之间平滑地转换与缩放图像。

Android 5.0(API Level 21)支持这些进入与退出转换:(普通过渡动画)

  • 分解 - 从场景中心移入或移出视图。
  • 滑动 - 从场景边缘移入或移出视图。
  • 淡入淡出 - 通过调整透明度在场景中增添或移除视图。

也支持这些共享元素转换:(共享元素的过渡动画)

  • changeBounds - 为目标视图的大小添加动画。
  • changeClipBounds - 为目标视图的裁剪大小添加动画。
  • changeTransform - 为目标视图的缩放、旋转和位移添加动画。
  • changeImageTransform - 为目标图片的缩放、旋转和位移添加动画。

指定转场动画

要想使用新的转场动画,可以继承Material Design主题后在style风格中指定:

其中,change_image_transform定义如下:

 
 
  1. <!-- res/transition/change_image_transform.xml --> 
  2.  
  3. <!-- (see also Shared Transitions below) --> 
  4.  
  5. <transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
  6.  
  7.   <changeImageTransform/> 
  8.  
  9. </transitionSet>  

如果要带代码中开启窗口内容转换,需要调用Window.requestFeature()方法。

普通转场动画:

所有继承自visibility类都可以作为进入、退出的过度动画。如果我们想自定义进入和退出时的动画效果,只需要继承Visibility,重载onAppear和onDisappear方法来定义进入喝退出的动画。系统提供了三种默认方式:

  • explode 从屏幕中心移入或移出视图
  • slide 从屏幕边缘移入或移出视图
  • fade 改变视图的透明度

想在xml中指定自定义的进入、退出的过度动画需要先对动画进行定义:

 
 
  1. <transition class="my.app.transition.CustomTransition"/> 

注意:其中CustomTransition是我们自定义的动画,它必须继承自Visibility。

想以普通转场动画的方式启动一个Activity,必须在startActivity函数中传递一个ActivityOptions的Bundle对象:

 
 
  1. ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity);  
  2.  
  3. startActivity(intent, options.toBundle());  

如果想让返回也具备转场效果,那么在返回的Activity中不要再调用finish函数,而是应该使finishAfterTransition来结束一个Activity,该函数会等待动画执行完毕才结束该Activity。

共享转场动画:

如果要在两个具有共享元素的Activity之间使用转场动画,那么:

1、在题中启用窗口内容转换。android:windowContentTransitions

2、在Theme中指定一个共享元素转换。

3、将transitions定义为xml资源。

4、利用 android:transitionName属性对两个布局中的共享元素指定一个通用名称。

5、使用 ActivityOptions.makeSceneTransitionAnimation()方法。

 
 
  1. // get the element that receives the click event 
  2.  
  3. final View imgContainerView = findViewById(R.id.img_container); 
  4.  
  5.  
  6. // get the common element for the transition in this activity 
  7.  
  8. final View androidRobotView = findViewById(R.id.image_small); 
  9.  
  10.  
  11. // define a click listener 
  12.  
  13. imgContainerView.setOnClickListener(new View.OnClickListener() { 
  14.  
  15.     @Override 
  16.  
  17.     public void onClick(View view) { 
  18.  
  19.         Intent intent = new Intent(this, Activity2.class); 
  20.  
  21.         // create the transition animation - the images in the layouts 
  22.  
  23.         // of both activities are defined with android:transitionName="robot" 
  24.  
  25.         ActivityOptions options = ActivityOptions 
  26.  
  27.             .makeSceneTransitionAnimation(this, androidRobotView, "robot"); 
  28.  
  29.         // start the new activity 
  30.  
  31.         startActivity(intent, options.toBundle()); 
  32.  
  33.     } 
  34.  
  35. });  

如果要在代码中生成共享view,那么需要调用View.setTransitionName()方法对两个布局中的共享元素指定一个通用名称。

如果有多个共享元素,则可以通过Pair进行包装处理:

 
 
  1. ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity, 
  2.  
  3.       Pair.create(view1, "name1"),//这里view1、view2如果是TextView或者ImageView等,需要转成View类型才可以 
  4.  
  5.       Pair.create(view2, "name2"));       
  6.  
  7. startActivity(intent,.toBundle());  

返回时如果需要具备转场动画,那么也需要用finish函数替代finishAfterTransition来结束一个Activity。

使用曲线运动

因为曲线运动和属性动画以及贝塞尔曲线这些东西混杂在一起,所以准备把这节拿出来单独写。这里就不多说了。

视图状态改变

Android 5.0在原有的图片选择器和颜色选择器上进行了增强,不仅是控件能根据不同的状态显示不同的背景图片,还能在两种状态切换时指定一个动画,来增加过渡效果,吸引用户眼球,以突出重点内容。

StateListAnimator类和图片选择器,颜色选择器类似,可以根据view的状态改变呈现不同的动画效果,通过xml我们可以构建对应不同状态的动画合集,其使用方式也非常简单,在对应的状态指定一个属性动画即可:

 
 
  1. <selector xmlns:android="http://schemas.android.com/apk/res/android"
  2.  
  3.     <item android:state_pressed="true"
  4.  
  5.         <set
  6.  
  7.             <objectAnimator android:propertyName="translationZ" 
  8.  
  9.                             android:duration="200" 
  10.  
  11.                             android:valueTo="20dp" 
  12.  
  13.                             android:valueType="floatType"/> 
  14.  
  15.         </set
  16.  
  17.     </item> 
  18.  
  19.     <item android:state_enabled="true" android:state_pressed="false"
  20.  
  21.         <set
  22.  
  23.             <objectAnimator android:propertyName="translationZ" 
  24.  
  25.                             android:duration="200" 
  26.  
  27.                             android:valueTo="0" 
  28.  
  29.                             android:valueType="floatType"/> 
  30.  
  31.         </set
  32.  
  33.     </item> 
  34.  
  35. </selector>  

代码中这样加载即可:

 
 
  1. TextView tv11 = (TextView) findViewById(R.id.tv11); 
  2.  
  3. StateListAnimator stateLAnim = AnimatorInflater.loadStateListAnimator(this,R.drawable.selector_for_button); 
  4.  
  5. tv11.setStateListAnimator(stateLAnim);  

继承了Material主题后,按钮默认拥有了z属性动画。如果想取消这种默认状态,可以把状态动画指定为null。

除了StateListAnimator类指定状态切换的属性动画外,还可以通过AnimatedStateListDrawable来指定状态切换的帧动画:

 
 
  1. <animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
  2.  
  3.     <item android:id="@+id/pressed" android:drawable="@drawable/btn_check_15" android:state_pressed="true"/> 
  4.  
  5.     <item android:id="@+id/normal"  android:drawable="@drawable/btn_check_0"/> 
  6.  
  7.     <transition android:fromId="@+id/normal" android:toId="@+id/pressed"
  8.  
  9.         <animation-list> 
  10.  
  11.             <item android:duration="20" android:drawable="@drawable/btn_check_0"/> 
  12.  
  13.             <item android:duration="20" android:drawable="@drawable/btn_check_1"/> 
  14.  
  15.             <item android:duration="20" android:drawable="@drawable/btn_check_2"/> 
  16.  
  17.         </animation-list> 
  18.  
  19.     </transition> 
  20.  
  21. </animated-selector>  

帧动画的资源文件直接在xml中作为view的background即可。

四、矢量图动画

效果图:

先在drawable中定义一张矢量图:

 
 
  1. <?xml version="1.0" encoding="utf-8"?> 
  2.  
  3. <vector xmlns:android="http://schemas.android.com/apk/res/android" 
  4.  
  5.     android:height="200dp" 
  6.  
  7.     android:width="200dp" 
  8.  
  9.     android:viewportHeight="400" 
  10.  
  11.     android:viewportWidth="400"
  12.  
  13.      
  14.  
  15.     <group 
  16.  
  17.         android:name="rotationGroup" 
  18.  
  19.         android:pivotX="0" 
  20.  
  21.         android:pivotY="0"
  22.  
  23.           
  24.  
  25.         <path 
  26.  
  27.             android:name="star" 
  28.  
  29.             android:pathData="M 100,100 h 200 l -200 150 100 -250 100 250 z" 
  30.  
  31.             android:strokeColor="@color/colorPrimary" 
  32.  
  33.             android:strokeLineCap="round" 
  34.  
  35.             android:strokeWidth="10"/> 
  36.  
  37.          
  38.  
  39.     </group
  40.  
  41. </vector>  

然后在anim中定义动画:

 
 
  1. <?xml version="1.0" encoding="utf-8"?> 
  2.  
  3. <set xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.     <objectAnimator 
  6.  
  7.         android:propertyName="trimPathStart" 
  8.  
  9.         android:valueFrom="0" 
  10.  
  11.         android:valueTo="1" 
  12.  
  13.         android:valueType="floatType" 
  14.  
  15.         android:duration="2000" 
  16.  
  17.         android:repeatMode="reverse" 
  18.  
  19.         android:repeatCount="-1" 
  20.  
  21.         android:interpolator="@android:interpolator/accelerate_decelerate"/> 
  22.  
  23. </set 

最后在drawable中定义一个animated-vector:将动画资源指定给drawable属性值的矢量图。

 
 
  1. <?xml version="1.0" encoding="utf-8"?><animated-vector xmlns:android="http://schemas.android.com/apk/res/android" 
  2.    android:drawable="@drawable/vector_drawable"
  3.    <target 
  4.        android:name="star" 
  5.        android:animation="@anim/animation"/></animated-vector>  

注意:这里drawable属性值是前面我们定义的矢量图,target中name要和矢量图中path的name一样,animation就是前面定义的动画资源文件。

在view的xml中使用以及在代码中开始动画:

 
 
  1. <ImageView 
  2.  
  3.     android:id="@+id/iv" 
  4.  
  5.     android:layout_width="wrap_content" 
  6.  
  7.     android:layout_height="wrap_content" 
  8.  
  9.     android:layout_margin="20dp" 
  10.  
  11.     app:srcCompat="@drawable/anim_vector_drawable" 
  12.  
  13.     android:layout_gravity="center"/>   
 
 
  1. ImageView iv = (ImageView) findViewById(R.id.iv); 
  2.  
  3. Drawable drawable = iv.getDrawable(); 
  4.  
  5. if (drawable instanceof Animatable) { 
  6.  
  7.     ((Animatable) drawable).start(); 
  8.  
  9.  





作者:shenhuniurou
来源:51CTO
目录
相关文章
|
3月前
|
搜索推荐 算法 Android开发
盘点 Material Design 3 带来的新变化
盘点 Material Design 3 带来的新变化
79 1
|
XML 开发工具 开发者
Material Design 实战
主要是google提出的一种设计应用的规范,并且为了方便开发者,Google将一系列设计好的组件进行了一些比较好的封装,使得我们普通的开发者也能设计出较为美观的界面,只要引入Material库就可以使用那些组件了
99 0
|
Android开发
Material Design 实战 之第一弹——Toolbar详解
Material Design 实战 之第一弹——Toolbar详解
|
编解码 调度 Android开发
在项目中运用Meterial Design实现动画效果
在 2015 年的 I/O 开发者大会上,Google 介绍了一个新的 Android Design Support Library,该库可以帮助开发者在应用上使用 meterial design。以前在自己公司的项目上有用过,最近把这个库中的 CoordinatorLayout单独拿出来做了个小例子写篇博文,纯粹当成整理复习笔记,下次如果需求再碰到这个,直接用上 。。。
103 0
在项目中运用Meterial Design实现动画效果
|
Windows
UWP Acrylic Material
原文:UWP Acrylic Material 文档:https://docs.microsoft.com/en-us/windows/uwp/design/style/acrylic Acrylic 能带来类似 win7 的毛玻璃效果 要使用 Acrylic ,需要 win10 的版本最低为 ...
999 0
|
XML Android开发 数据格式
Material Design系列(一)- CollapsingToolbarLayout 和AppBarLayout
1. 什么是CoordinatorLayout CoordinatorLayout是Android官方在Design包提供的控件,来自官方的解释是: CoordinatorLayout is a super-powered FrameLayout 它主要用于两个方面: 当做普通的FrameLayout作为根布局使用 作为一个或者多个子View进行复杂交互的容器 CoordinatorLayout为我们提供了一个叫做Behavior的东西,我们基本上的复杂交互都是使用Behavior来协调完成。
1642 0
|
Android开发 数据安全/隐私保护 iOS开发
使用 Sketch 和 Pixate 构建 Material Design 原型 - 第一部分
本文讲的是使用 Sketch 和 Pixate 构建 Material Design 原型 - 第一部分,你是否曾经对某一款应用有过很棒的想法或者想向别人展示你的想法会带来改变?可是否又有以下限制令你止步?
1457 0
|
Android开发
使用 Sketch 和 Pixate 构建 Material Design 原型 - 第二部分
本文讲的是使用 Sketch 和 Pixate 构建 Material Design 原型 - 第二部分,打开 Pixate 并且点击 “ Create new prototype ” 来创建一个原型,或者从“ File ”菜单新建一个。
1315 0
使用 Sketch 和 Pixate 构建 Material Design 原型 - 第三部分
本文讲的是使用 Sketch 和 Pixate 构建 Material Design 原型 - 第三部分,最后在这个总结性的第三部分,我们将进一步深入,同时将会作出一个更细致的原型。 开始之前,你应该已经完成了 Part 1 andPart 2 , 如果没有的话,先去看看这两篇内容吧.
977 0