我有一個帶有背景位圖的LinearLayout。我使用動畫將2-3個圖像添加到此佈局。問題是:每次我添加圖像時,FIRST圖像動畫從左上角開始,對於在該動畫之後的其他每個圖像,它都可以正常工作。我正在努力尋找解決這個小煩人問題的日子。你有什麼建議嗎?在android中添加和動畫imageViews時出現奇怪的行爲
這裏我是GIF格式的問題,我提出:http://imgur.com/FCPgof1
我的動畫:`
<scale
android:duration="750"
android:fillAfter="false"
android:fromXScale="0"
android:fromYScale="0.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" />
`
我的佈局:
<LinearLayout
android:id="@+id/layoutCompareUppoints"
android:layout_width="140dp"
android:layout_height="28dp"
android:background="@drawable/uppballsbgnew" >
</LinearLayout>
我的代碼: `私人void animUppointsBefore(){
if (k < Integer.valueOf(uppoints)) {
Animation a = AnimationUtils.loadAnimation(this,
R.anim.debug_grow_fast_animation);
ImageView upp = new ImageView(this);
upp.setImageResource(R.drawable.uppballlightnew);
upp.setAdjustViewBounds(true);
uppLayout.addView(upp);
upp.startAnimation(a);
a.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation a) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation a) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animation a) {
// TODO Auto-generated method stub
k++;
animUppointsBefore();
}
});
}
}`
如果您在Q – Tasos
中添加代碼,我將添加我的動畫代碼。但是我想再次說,在我添加第一個圖像後,我的代碼對於每個圖像都正常工作。這使得它很難理解 –
你有沒有嘗試過RelativeLayout?我知道的LinearLayout是不是免費的圖像操作非常友好 – Pooya