編輯:關於Android編程
控件View的動畫(如Dialog窗口中的圓形進度條) 空間Window的動畫(如DialogWindow,PopupWindow的動畫,Activity切換時整個Window頁面的動畫) ViewGroup的LayoutAnimation動畫,每個子控件按照設定的順序、延遲播放動畫動畫常用anim/*.xml定義
xml中定義動畫,可直接使用標簽直接定義,也可以放在 標簽中,裡面定義的動畫將同時開始播放。 兩者都可使用AnimationUtils.loadAnimation方法加載。如果是set標簽定義,加載時返回的是AnimationSet實例(AnimationSet繼承自Animation)。 在set標簽中設置的一些屬性,會直接覆蓋它裡面定義動畫的對應屬性,而 AnimationSet的另外一些從Animation繼承的屬性則無效,下面是AnimationSet類的官方說明。
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.The way that AnimationSet inherits behavior from Animation is important to understand. Some of the Animation attributes applied to AnimationSet affect the AnimationSet itself, some are pushed down to the children, and some are ignored, as follows:
Starting withandroid.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH
, the behavior of these properties is the same in XML resources and at runtime (prior to that release, the values set in XML were ignored for AnimationSet). That is, callingsetDuration(500)
on an AnimationSet has the same effect as declaringandroid:duration="500"
in an XML resource for an AnimationSet object.
常規補間動畫:彈跳(移動)
Layout/activity_welcome_anim.xml(0%p表示占父組件尺寸的百分比)
"1.0" encoding="utf-8"?>"http://schemas.android.com/apk/res/android" > "500" android:fromXDelta="0" android:fromYDelta="0%p" android:interpolator="@android:anim/accelerate_interpolator" android:toXDelta="0" android:toYDelta="42%p" /> "350" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/decelerate_interpolator" android:startOffset="500" android:toXDelta="0" android:toYDelta="-21%p" /> "350" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/accelerate_interpolator" android:startOffset="850" android:toXDelta="0" android:toYDelta="21%p" /> "250" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/decelerate_interpolator" android:startOffset="1200" android:toXDelta="0" android:toYDelta="-10%p" /> "250" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/accelerate_interpolator" android:startOffset="1450" android:toXDelta="0" android:toYDelta="10%p" /> "150" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/decelerate_interpolator" android:startOffset="1700" android:toXDelta="0" android:toYDelta="-5%p" /> "150" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/accelerate_interpolator" android:startOffset="1850" android:toXDelta="0" android:toYDelta="5%p" />
可使用Java程序加載
再例如常規補間動畫:縮放、透明度
"1.0" encoding="utf-8"?>"http://schemas.android.com/apk/res/android" > "800" android:fromXScale="0.0" android:fromYScale="0.0" android:pivotX="50%" android:pivotY="50%" android:toXScale="1.0" android:toYScale="1.0" /> "800" android:fromAlpha="0.0" android:toAlpha="1.0" />
再如上浮效果(移動、透明度)
"1.0" encoding="utf-8"?>"http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" > "500" android:fromXDelta="0" android:fromYDelta="5%" android:toXDelta="0" android:toYDelta="0%" /> "500" android:fromAlpha="0.0" android:toAlpha="1.0" /> "100" android:fromAlpha="1.0" android:startOffset="1400" android:toAlpha="1.0" />
startActivity(new Intent(this, ListAlarm.class)); overridePendingTransition(R.anim.anim_activity_in, R.anim.anim_activity_unchange);
ActivityGuide.this.finish(); overridePendingTransition(R.anim.alpha_stay, R.anim.alpha_exit);
Manifest.xml "@style/app_theme" > ".ui.ActivityWelcome" android:theme="@style/app_theme_fullscreen" >
style.xml
anim/quick_alpha_enter.xml
anim/quick_alpha_stay.xml
1、在 layout_anim_item.xml 中定義子View動畫
2、在 layout_anim.xml 中定義Layout動畫,並引用子View動畫
"http://schemas.android.com/apk/res/android" android:animation="@anim/layout_anim_item" android:animationOrder="normal" android:delay="0.25" />
3、在ViewGroup中引用自定義Layout動畫"@anim/layout_anim" >
如果你自己想做一個客戶端玩玩,但是又不想去搭建後台服務器,顯然Bmob移動後端雲是你的最佳選擇。官方地址見bmob,他提供了Android的sdk,同樣也提供了Restf
Android應用程序內存洩漏介紹內存洩漏和內存溢出的區別內存溢出(out of memory)是指程序在申請內存時,沒有足夠的內存空間供其使用,出現out of mem
1.問題是如何發生的,會在什麼情況下發生此類問題?當用戶運用手機清理助手或後台回收我們的應用造成我們應用程序進程被殺死的時候就有可能出現這種空指針的問題,下面舉個例子我們
其實我一直准備寫一篇關於Android事件分發機制的文章,從我的第一篇博客開始,就零零散散在好多地方使用到了Android事件分發的知識。也有好多朋友問過我各種問題,比如