こんにちは、基本的な問題があります。2 つのアニメーション セット (left_to_right と right_to_left) があります。どのボタンをクリックするとアニメーションが開始されますか (1 つのイメージビューがあります)。
私の問題は、ビューのアニメーションが変わらないことです
私のコードはここにあります:
resim=(ImageView)findViewById(R.id.image_sayfa);
sol=AnimationUtils.loadAnimation(this,R.anim.soltosag);
sag=AnimationUtils.loadAnimation(this,R.anim.sagtosol);
b1=(Button)findViewById(R.id.sol);
b2=(Button)findViewById(R.id.sag);
b1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
resim.setAnimation(null);
resim.startAnimation(sol);
}
});
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
resim.startAnimation(sol);
}
}
});
アニメ/right_to_left:sag.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:toXDelta="100%"
android:fromXDelta="0"
android:duration="1250"
android:fillAfter="true"
/>
<alpha
android:fromAlpha="1.0"
android:toAlpha="0"
android:duration="1250"
/>
</set>
アニメ/左から右:sol.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="-100%"
android:toXDelta="0"
android:duration="1250"
/>
<alpha
android:fromAlpha="1.0"
android:toAlpha="0"
android:duration="1250"
/>
</set>