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.pswp.cn/news/257873.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/257873.shtml
英文地址,請注明出處:http://en.pswp.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 小于后者…