私はAndroidに比較的慣れていません。
説明 -
LinearLayoutwithがTextView入っています。TextView動的に追加しています。
に触れTextViewたらやりたいし、もう一度ScaleUp同じに触れたらやりたい。TextViewScaleDown
私の問題は -
- a
TextViewがscaled upで、その他TextViewがの場合touched。古いものTextViewとscale down新しいtouchedTextViewものscale up。 - に触れると
scaled upTextView、これTextViewは縮小するはずです。
これは私が試したものです
私は2セットのxmlを持っています。スケールアップ用 1
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale="3.0"
android:toYScale="3.0" >
</scale>
もう1つはスケールダウン用
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="3.0"
android:fromYScale="3.0"
android:toXScale="1.0"
android:toYScale="1.0" >
</scale>
私Activityのクラス -
myTextView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (myTextView.getAnimation() == null) {
Animation a = AnimationUtils.loadAnimation(
getBaseContext(), R.anim.scale_up);
a.setFillAfter(true);
v.startAnimation(a);
} else {
v.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v1,
MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
Animation a1 = AnimationUtils
.loadAnimation(
getBaseContext(),
R.anim.scale_down);
a1.setFillAfter(true);
v1.startAnimation(a1);
}
return true;
}
});
}
}
return false;
}
});