Android 动画效果及Interpolator和AnimationListener的使用

转载http://www.itzhai.com/android-animation-used-to-achieve-control-of-animation-effects-and-use-of-interpolator-and-animationlistener.html
android:interpolator
可能有很多人不理解它的用法,文档里说的也不太清楚,其实很简单,看下面:interpolator定义一个动画的变化率(the rate of change)。这使得基本的动画效果(alpha, scale, translate, rotate)得以加速,减速,重复等。用通俗的一点的话理解就是:动画的进度使用 Interpolator 控制。interpolator 定义了动画的变化速度,可以实现匀速、正加速、负加速、无规则变加速等。Interpolator 是基类,封装了所有 Interpolator 的共同方法,它只有一个方法,即 getInterpolation (float input),该方法 maps a point on the timeline to a multiplier to be applied to the transformations of an animation。Android 提供了几个 Interpolator 子类,实现了不同的速度曲线,如下:
AccelerateDecelerateInterpolator 在动画开始与介绍的地方速率改变比较慢,在中间的时侯加速
AccelerateInterpolator 在动画开始的地方速率改变比较慢,然后开始加速
CycleInterpolator 动画循环播放特定的次数,速率改变沿着正弦曲线
DecelerateInterpolator 在动画开始的地方速率改变比较慢,然后开始减速
LinearInterpolator 在动画的以均匀的速率改变
对于 LinearInterpolator ,变化率是个常数,即 f (x) = x.
public float getInterpolation(float input) {
return input;
}
Interpolator其他的几个子类,也都是按照特定的算法,实现了对变化率。还可以定义自己的 Interpolator 子类,实现抛物线、自由落体等物理效果。

 

Animation的4个基本动画效果

What is Animation?

public abstract class
Animation
extends Object
implements Cloneable

Abstraction for an Animation that can be applied to Views, Surfaces, or other objects.

1、AlphaAnimation:淡入淡出效果
public class
AlphaAnimation
extends Animation

An animation that controls the alpha level of an object. Useful for fading things in and out. This animation ends up changing the alpha property of aTransformation

Public Constructors
AlphaAnimation(Context context, AttributeSet attrs)
Constructor used when an AlphaAnimation is loaded from a resource.
AlphaAnimation(float fromAlpha, float toAlpha)
Constructor to use when building an AlphaAnimation from code
public class
AnimationSet
extends Animation

Represents a group of Animations that should be played together. The transformation of each individual animation are composed together into a single transform. If AnimationSet sets any properties that its children also set (for example, duration or fillBefore), the values of AnimationSet override the child values.


在代码中实现动画效果的方法:

ImageView imageView = (ImageView) findViewById(R.id.imageView1);
AnimationSet animationSet = new AnimationSet(true);
AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
alphaAnimation.setDuration(1000);
alphaAnimation.setStartOffset(10000);
animationSet.addAnimation(alphaAnimation);
//animationSet.setStartOffset(10000);
animationSet.setFillBefore(false);
animationSet.setFillAfter(true);
imageView.startAnimation(animationSet);


在XML文件中实现动画效果的方法:

① 在res目录下创建一个anim文件夹,在里面添加一个alpha.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"android:fillAfter="true"android:fillBefore="false"><alphaandroid:fromAlpha="1.0"android:toAlpha="0.0"android:startOffset="1000"android:duration="1000" /></set>

② 在Activity中使用AnimationUtils获取Animation并进行设置:

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.alpha);
imageView.startAnimation(animation);
2、ScaleAnimation:缩放效果
public class
ScaleAnimation
extends Animation

An animation that controls the scale of an object. You can specify the point to use for the center of scaling.

Public Constructors
ScaleAnimation(Context context, AttributeSet attrs)
Constructor used when a ScaleAnimation is loaded from a resource.
ScaleAnimation(float fromX, float toX, float fromY, float toY)
Constructor to use when building a ScaleAnimation from code
ScaleAnimation(float fromX, float toX, float fromY, float toY, float pivotX, float pivotY)
Constructor to use when building a ScaleAnimation from code
ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
Constructor to use when building a ScaleAnimation from code


在代码中实现动画效果:

ImageView imageView = (ImageView) findViewById(R.id.imageView1);
AnimationSet animationSet = new AnimationSet(true);
ScaleAnimation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,Animation.RELATIVE_TO_SELF, 1f,Animation.RELATIVE_TO_SELF, 1f);
animationSet.addAnimation(scaleAnimation);
animationSet.setDuration(1000);
imageView.startAnimation(animationSet);


在XML文件中实现动画效果的方法:

① 在res的anim文件夹下,创建一个scale.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"><scale android:fromXScale="1.0"android:toXScale="0.0"android:fromYScale="1.0"android:toYScale="0.0"android:pivotX="50%"android:pivotY="50%"android:duration="2000" /></set>

② 在Activity中使用AnimationUtils获取Animation并进行设置:

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.scale);
imageView.startAnimation(animation);
3、Rotate:旋转效果
public class
RotateAnimation
extends Animation

An animation that controls the rotation of an object. This rotation takes place int the X-Y plane. You can specify the point to use for the center of the rotation, where (0,0) is the top left point. If not specified, (0,0) is the default rotation point.

Public Constructors
RotateAnimation(Context context, AttributeSet attrs)
Constructor used when a RotateAnimation is loaded from a resource.
RotateAnimation(float fromDegrees, float toDegrees)
Constructor to use when building a RotateAnimation from code.
RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY)
Constructor to use when building a RotateAnimation from code
RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
Constructor to use when building a RotateAnimation from code


在代码中实现动画效果:

ImageView imageView = (ImageView) findViewById(R.id.imageView1);
AnimationSet animationSet = new AnimationSet(true);
RotateAnimation rotateAnimation = new RotateAnimation(0, 360,Animation.RELATIVE_TO_PARENT, 0.5f,Animation.RELATIVE_TO_PARENT, 0.5f);
rotateAnimation.setDuration(1000);
animationSet.addAnimation(rotateAnimation);
imageView.startAnimation(animationSet);


在XML文件中实现动画效果的方法:

① 在res的anim文件夹下,创建一个rotate.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"><rotate android:fromDegrees="0"android:toDegrees="+360"android:pivotX="50%"android:pivotY="50%"android:duration="1000" />
</set>

② 在Activity中使用AnimationUtils获取Animation并进行设置:

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.rotate);
imageView.startAnimation(animation);
4、 Translate:移动效果
public class
TranslateAnimation
extends Animation

An animation that controls the position of an object.

Public Constructors
TranslateAnimation(Context context, AttributeSet attrs)
Constructor used when a TranslateAnimation is loaded from a resource.
TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
Constructor to use when building a TranslateAnimation from code
TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue)
Constructor to use when building a TranslateAnimation from code


在代码中实现动画效果:

ImageView imageView = (ImageView) findViewById(R.id.imageView1);
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f,Animation.RELATIVE_TO_SELF, 1.0f,Animation.RELATIVE_TO_SELF, 0f,Animation.RELATIVE_TO_SELF, 1.0f);
translateAnimation.setDuration(1000);
animationSet.addAnimation(translateAnimation);
imageView.startAnimation(animationSet);


在XML文件中实现动画效果的方法:

① 在res的anim文件夹下,创建一个translate.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"><translateandroid:fromXDelta="0%p"android:toXDelta="100%p"android:fromYDelta="0%p"android:toYDelta="100%p"android:duration="1000" /></set>

其中100%p表示相对于父空间的位置

② 在Activity中使用AnimationUtils获取Animation并进行设置:

Animation animation = (Animation) AnimationUtils.loadAnimation(MainActivity.this, R.anim.translate);
imageView.startAnimation(animation);
也可以使用AnimationSet为一个控件添加多个动画,或者在xml文件中添加多个动画标签,以下分别使用代码和XML文件实现相同的效果:
代码中实现:
AnimationSet animationSet = new AnimationSet(false);
AlphaAnimation alpha = new AlphaAnimation(1.0f, 0.0f);
ScaleAnimation scale = new ScaleAnimation(1, 0.5f, 1, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(alpha);
animationSet.addAnimation(scale);
animationSet.setDuration(2000);
animationSet.setStartOffset(1000);
animationSet.setFillAfter(true);
imageView.startAnimation(animationSet);
XML实现:

alpha.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"android:shareInterpolator="true"android:fillAfter="true"><alphaandroid:fromAlpha="1.0"android:toAlpha="0.0"android:startOffset="1000"android:fillAfter="true"android:duration="2000" /><scale android:fromXScale="1.0"android:toXScale="0.5"android:fromYScale="1.0"android:toYScale="0.5"android:pivotX="50%"android:pivotY="50%"android:startOffset="1000"android:duration="2000" />
</set>

Activity中的代码:

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.alpha);
imageView.startAnimation(animation);
Interpolator的使用


什么是Interpolator

public class
Interpolator
extends Object
Interpolator定义了动画变化的速率或规律,其具体的实现可以使用以下子类:


AccelerateDecelerateInterpolator:

public class
AccelerateDecelerateInterpolator
extends Object
implements Interpolator

An interpolator where the rate of change starts and ends slowly but accelerates through the middle.


AccelerateInterpolater:

public class
AccelerateInterpolator
extends Object
implements Interpolator

An interpolator where the rate of change starts out slowly and and then accelerates.


CycleInterpolator:

public class
CycleInterpolator
extends Object
implements Interpolator

Repeats the animation for a specified number of cycles. The rate of change follows a sinusoidal pattern.


DecelerateInterpolator:

public class
DecelerateInterpolator
extends Object
implements Interpolator

An interpolator where the rate of change starts out quickly and and then decelerates.


LinearInterpolator:

public class
LinearInterpolator
extends Object
implements Interpolator

An interpolator where the rate of change is constant.

这些Interpolator可以在代码或XML文件中定义:


XML文件定义在set标签里或每个动画标签

set标签中定义:

<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"android:shareInterpolator="true"android:fillAfter="true">

每个动画标签中定义:

<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"android:shareInterpolator="false"android:fillAfter="true"><alphaandroid:interpolator="@android:anim/accelerate_interpolator"android:fromAlpha="1.0"android:toAlpha="0.0"android:startOffset="1000"android:fillAfter="true"android:duration="2000" /><scaleandroid:interpolator="@android:anim/accelerate_decelerate_interpolator"android:fromXScale="1.0"android:toXScale="0.5"android:fromYScale="1.0"android:toYScale="0.5"android:pivotX="50%"android:pivotY="50%"android:startOffset="1000"android:duration="2000" />
</set>


在代码中设置:

AnimationSet animationSet = new AnimationSet(true);
animationSet.setInterpolator(new AccelerateInterpolator());

或者分别为每个动画设置:

AnimationSet animationSet = new AnimationSet(false);
AlphaAnimation alpha = new AlphaAnimation(1.0f, 0.0f);
alpha.setInterpolator(new AccelerateInterpolator());
ScaleAnimation scale = new ScaleAnimation(1, 0.5f, 1, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f);
scale.setInterpolator(new AccelerateDecelerateInterpolator());
Frame-By-Frame Animations的使用

① 准备4张图片run1.png,run2.png,run3.png,run4.png分别放到res的三个drawable文件夹中
② 在res的drawable-ldpi目录下创建一个anim_run.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"android:oneshot="false"><item android:drawable="@drawable/run1" android:duration="100" /><item android:drawable="@drawable/run2" android:duration="100" /><item android:drawable="@drawable/run3" android:duration="100" /><item android:drawable="@drawable/run4" android:duration="100" />
</animation-list>

③ 在Activity中使用xml文件设置ImageView控件imageView的背景源,并获取AnimationDrawable进行显示动画:

imageView.setBackgroundResource(R.drawable.anim_run);
AnimationDrawable animationDrawable = (AnimationDrawable)imageView.getBackground();
animationDrawable.start();
使用LayoutAnimationController设置ListView的动画


什么是LayoutAnimationController?

public class
LayoutAnimationController
extends Object

A layout animation controller is used to animated a layout's, or a view group's, children. Each child uses the same animation but for every one of them, the animation starts at a different time. A layout animation controller is used by ViewGroup to compute the delay by which each child's animation start must be offset. The delay is computed by using characteristics of each child, like its index in the view group. This standard implementation computes the delay by multiplying a fixed amount of miliseconds by the index of the child in its parent view group. Subclasses are supposed to override getDelayForView(android.view.View) to implement a different way of computing the delay. For instance, aGridLayoutAnimationController will compute the delay based on the column and row indices of the child in its parent view group. Information used to compute the animation delay of each child are stored in an instance of LayoutAnimationController.AnimationParameters, itself stored in theViewGroup.LayoutParams of the view.


在使用LayoutAnimationController控制ListView控件的样式效果的方法:

① 在res的anim文件夹中创建一个list_anim.xml文件用于控制ListView控件的动画:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/accelerate_interpolator"android:shareInterpolator="true"><scale android:fromXScale="0.0"android:toXScale="1.0"android:fromYScale="0.0"android:toYScale="1.0"android:pivotX="50%"android:pivotY="50%"android:duration="1000" />
</set>

② 创建一个布局文件item.xml用于设置ListView的item的样式:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent" android:layout_height="fill_parent"android:orientation="horizontal" android:paddingLeft="10dip"android:paddingRight="10dip" android:paddingTop="1dip"android:paddingBottom="1dip"><TextView android:id="@+id/user_name" android:layout_width="180dip"android:layout_height="30dip"android:textSize="10pt"android:singleLine="true" /><TextView android:id="@+id/user_id" android:layout_width="fill_parent"android:layout_height="fill_parent"android:textSize="10pt"android:singleLine="true"/>
</LinearLayout>

③ 在主Activity的布局文件main.xml中添加一个ListView

<ListViewandroid:id="@id/android:list"android:layout_width="fill_parent"android:layout_height="wrap_content"android:scrollbars="vertical"android:layoutAnimation="@anim/anim_layout"/>

④ 创建一个MainActivity继承ListActivity,并在onCreate方法中添加如下代码:

ListView listView = getListView();List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
HashMap<String, String> hm1 = new HashMap<String, String>();
hm1.put("user_name", "arthinking");
hm1.put("user_id", "001");
HashMap<String, String> hm2 = new HashMap<String, String>();
hm2.put("user_name", "Jason");
hm2.put("user_id", "002");
list.add(hm1);
list.add(hm2);SimpleAdapter simpleAdapter = new SimpleAdapter(this, list,R.layout.item, new String[] { "user_name", "user_id" },new int[] { R.id.user_name, R.id.user_id });
listView.setAdapter(simpleAdapter);//通过Animation获取LayoutAnimationController对ListView进行设置
Animation animation = (Animation)AnimationUtils.loadAnimation(MainActivity.this, R.anim.list_anim);
LayoutAnimationController lac = new LayoutAnimationController(animation);
lac.setOrder(LayoutAnimationController.ORDER_NORMAL);
lac.setDelay(0.5f);
listView.setLayoutAnimation(lac);

这样,运行程序,显示的ListView就会按照xml文件中预置的动画效果显示了。

也可以通过xml文件进行设置动画:

① 在以上步骤的基础之上,在res/anim文件夹下创建一个anim_layout.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"android:delay="1"android:animationOrder="normal"android:animation="@anim/list_anim" />

② main在布局文件的的ListView添加如下属性:

android:layoutAnimation="@anim/anim_layout"

这样就在把MainActivity的onCreate()方法中的
//通过Animation获取LayoutAnimationController对ListView进行设置
注释后的代码删除了,直接使用xml进行动画的控制。

AnimationListener的使用
public static interface
Animation.AnimationListener
android.view.animation.Animation.AnimationListener

An animation listener receives notifications from an animation. Notifications indicate animation related events, such as the end or the repetition of the animation.


包含以下的三个方法:

onAnimationEnd(Animation animation)
Notifies the end of the animation.
onAnimationRepeat(Animation animation)
Notifies the repetition of the animation.
onAnimationStart(Animation animation)
Notifies the start of the animation.
AnimationListener在控件中的使用:

① 可以为一个Button添加一个事件:

button.setOnClickListener(new TestAnimationListener());

② 接下来是编写这个TestAnimationListener类,继承AnimationListener,并覆盖里面的三个方法:

//这里获取控件组,R.id.layoutId为main.xml的整体布局标签的id属性值
ViewGroup viewGroup = (ViewGroup)findViewById(R.id.layoutId);private class RemoveAnimationListener implements AnimationListener{//该方法在淡出效果执行结束之后被调用@Overridepublic void onAnimationEnd(Animation animation) {//假设这里要在动画执行完之后删除一个TextViewviewGroup.removeView(textView);}@Overridepublic void onAnimationRepeat(Animation animation) {System.out.println("onAnimationRepeat");}@Overridepublic void onAnimationStart(Animation animation) {System.out.println("onAnimationStart");}}

③ 同样的,在动画效果中添加控件可以按照如下实现

ScaleAnimation scale = new ScaleAnimation(1, 0.5f, 1, 0.5f,
scale.setDuration(1000);
scale.setStartOffset(100);
TextView textView = new TextView(MainActivity.this);
textView.setText("add");
viewGroup.addView(textView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
textView.startAnimation(scale);

(特别说明:本文部分内容是在观看marschen的Android视频教程时做的笔记,感谢marschen推出的视频教程,这里也推荐给大家:http://www.marschen.com/portal.php)

除了文章中有特别说明,均为IT宅原创文章,转载请以链接形式注明出处。
本文链接:http://www.itzhai.com/android-animation-used-to-achieve-control-of-animation-effects-and-use-of-interpolator-and-animationlistener.html
关键字: AlphaAnimation, Android, AnimationListener, Interpolator, RotateAnimation, ScaleAnimation, TranslateAnimation

转载于:https://www.cnblogs.com/poorfish/p/4169345.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/257873.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

html怎么使图片无法另存为,如何禁止图片另存为?禁止网页另存为到本地的方法...

在很多企事业单位&#xff0c;处于商业机密保护的需要&#xff0c;常常需要禁止一些文件格式的“另存为”功能&#xff0c;防止通过“另存为”将文件另行保存&#xff0c;据为己有的目的&#xff1b;尤其是在局域网中访问服务器共享文件的时候&#xff0c;常常需要禁止将共享文…

正益工场为京西创客工场输送双创“软”实力

12月30日&#xff0c;中关村门头沟科技园“京西创客工场”正式揭牌&#xff0c;这里将成为京西“生态科创”的聚集地。正益工场作为唯一入驻的“移动互联网”双创生态平台&#xff0c;将为双创输送“移动技术移动模式”等软实力。北京市副市长隋振江、市政协、中关村管委会等领…

【动态规划】【线段树】 Codeforces Round #426 (Div. 1) B. The Bakery

给你一个序列&#xff0c;让你划分成K段&#xff0c;每段的价值是其内部权值的种类数&#xff0c;让你最大化所有段的价值之和。 裸dp f&#xff08;i&#xff0c;j&#xff09;max{f&#xff08;k&#xff0c;j-1&#xff09;w&#xff08;k1&#xff0c;i&#xff09;}&#…

几种服务器端IO模型的简单介绍及实现(转载)

作者&#xff1a;阿凡卢 出处&#xff1a;http://www.cnblogs.com/luxiaoxun/服务器端几种模型&#xff1a; 1、阻塞式模型&#xff08;blocking IO&#xff09; 我们第一次接触到的网络编程都是从 listen()、accpet()、send()、recv() 等接口开始的。使用这些接口可以很方便的…

html细边框表格代码,html中表格细边框的四种实现及其比较.doc

html中表格细边框的四种实现及其比较?html中表格细边框的四种实现及其比较第一种使用css!--- 华丽的分隔线。。 -- .box ?border-top-width: 1px;?border-right-width: 0px;?border-bottom-width: 0px;?border-left-width: 1px;?border-top-style: solid;?border-right-…

margin 等高布局

<div id"main"><div id"left">我是左边的内容的啦啦啦啦。。。。<br> 我是左边的内容的啦啦啦啦。。。。<br> 我是左边的内容的啦啦啦啦。。。。<br> 我是左边的内容的啦啦啦啦。。。。<br> 我是左边的内容的啦啦啦啦…

c、c++---linux上的GetTickCount函数

http://blog.csdn.net/guang11cheng/article/details/6865992 http://wenda.so.com/q/1378766306062794

C#判断一个类中有无指定名称的方法

C#中可以通过反射分析元数据来解决这个问题&#xff0c;示例代码如下&#xff1a;12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849using System;using System.Reflection;namespace Hello{class Program{static void Main(string[…

2021年高考成绩查询襄阳状元,大胆猜测一下,2021年高考,湖北省文理状元会花落谁家?...

随着2021年高考的逼近&#xff0c;考生进入紧张有序的复习中&#xff0c;家长也在为孩子筹谋着哪所学校更适合&#xff0c;作为吃瓜群众的我们&#xff0c;可能更关注今年湖北省的文理科状元会花落谁家&#xff0c;要知道&#xff0c;一所学校如果可以出现一名高考状元&#xf…

为什么写Java程序需要接口

为什么写Java程序需要接口 我之所以以这个作为标题&#xff0c;并不是为了玩噱头&#xff0c;讲一些似是而非的空话&#xff0c;还是以探索加发现&#xff0c; 追本溯源的讲解一下为什么Java需要接口&#xff0c;怎么理解&#xff0c;怎么用它。 首先接口并不是Java才有的&…

《领域特定语言》一1.5使用代码生成

1.5使用代码生成 在迄今为止的讨论中&#xff0c;要处理DSL&#xff0c;组装“语义模型”&#xff08;第11章&#xff09;&#xff0c;然后执行语义模型&#xff0c;提供我们希望从控制器得到的行为。在语言圈子里&#xff0c;这种方式称为解释&#xff08;interpretation&…

SVG 基础图形

SVG 基础图形 SVG包含了以下的基础图形元素&#xff1a; 矩形&#xff08;包括可选的圆角&#xff09;&#xff0c;使用<rect>元素创建圆形&#xff0c;使用<circle>元素创建椭圆形&#xff0c;使用<ellipse>元素创建直线&#xff0c;使用<line>元素创…

枣庄三中高考2021成绩查询,2021枣庄中考成绩查询系统入口

2021枣庄中考成绩查询系统入口2021-05-20 19:11:35文/王佳慧2021年&#xff0c;枣庄的中考时间快到了&#xff0c;本文分享了枣庄中考成绩查询入口&#xff0c;系统开通后考生可登陆查询成绩。枣庄中考成绩查询入口志愿填报须知1.录取标准&#xff1a;提前批、第一批、第三批学…

移动端”宴席知多少

转载(http://adt.aicai.com/index.php/archives/179/) 瞎折腾移动端的项目已经很长一段时间了&#xff0c;并不像其它企业一样&#xff0c;可以有项目组去完成&#xff0c;基本都是一个人瞎尝试&#xff0c;时而web&#xff0c;时而web app。恍恍惚惚过了这段岁月&#xff0c;也…

快速的取整方法(~~)

为什么80%的码农都做不了架构师&#xff1f;>>> 最近看一篇js装逼小技巧————双波浪号的妙用(将内容转化为数字,或者小数取整)&#xff0c;但是本身我的JavaScript水平比较低对其底层操作和其使用范围不甚了解&#xff1b;通过翻阅资料现进行简单的整理。 ###装…

git log友好显示

查看commit 提交日志 $ git log $git log --prettyoneline $git reflog 显示所有提交记录&#xff0c;包括已经回退的提交&#xff0c;如图&#xff1a;提交了abc 和 bb 然后回退到 abc   $git log 只显示abc提交 可以使用 $git reset --hard commit号 回退到bb git reflog…

jprofiler_windows-x64_9_1注册码

L-Larry_Lau163.com#5481-ucjn4a16rvd98#6038 L-Larry_Lau163.com#36573-fdkscp15axjj6#25257 转载于:https://www.cnblogs.com/sprinng/p/5104507.html

南理工计算机技术专业学位,南京理工大学计算机技术(专业学位)考研难吗

很多考生在准备南京理工大学计算机技术(专业学位)考研难吗&#xff1f;是考研报考的时候都会产生这样的疑问&#xff1a;这个专业的研究生好吗&#xff1f;适合我吗&#xff1f;对我以后的人生和职业会有帮助吗&#xff1f;考生在准备南京理工大学计算机技术(专业学位)专业考研…

《分布式系统:概念与设计》一2.3.2 体系结构模式

2.3.2 体系结构模式 体系结构模式构建在上述讨论过的相对原始的体系结构元素之上&#xff0c;提供组合的、重复出现的结构&#xff0c;这些结构在给定的环境中能运行良好。它们未必是完整的解决方案&#xff0c;但当与其他模式组合时&#xff0c;它们会更好地引导设计者给出一…

javascript sort()实现元素json对象的排序

看以下代码&#xff1a; var s [ { name: "Robin Van PurseStrings", age: 30 } ,{ name: "Theo Walcott", age: 24 } ,{ name: "Bacary Sagna", age: 28 } ].sort(function(obj1, obj2) {// 实现增序排列&#xff1a;前者的 age 小于后者…