タッチして画像をズーム表示する ImageButton のサンプルが Android Developer サイトで
紹介されている。
http://developer.android.com/training/animation/zoom.html
ここからダウンロードできる。
ここにあるのは、ズームしてからタッチして戻ると選択状態のハイライトの背景がかかったままになる。
戻った時、、、
これをズームから戻っても元の表示のままにしたいのだが、
戻っても、このようにしたい。
com.example.android.animationsdemo.TouchHighlightImageButton
の init() の中、
TypedArray a = getContext().obtainStyledAttributes(new int[]{ android.R.attr.selectableItemBackground });
mForegroundDrawable = a.getDrawable(0);
mForegroundDrawable.setCallback(this);
a.recycle();
ここら辺を修正すればできると思ったが、attr がよくわからず、
結局、drawableStateChanged メソッドでの invalidate をしないことにした。
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
// Update the state of the highlight drawable to match
// the state of the button.
// if (mForegroundDrawable.isStateful()) {
// mForegroundDrawable.setState(getDrawableState());
// }
//
// // Trigger a redraw.
// invalidate();
}
無理やりな方法なので良くないとは思ったけど。