スクロールして画像を表示するためにギャラリーを使用しています。getChildStaticTransformation(View child,Transformation t)
各画像にある各子に変換を適用する方法を使用しました。
しかし、今はボタンを使って画像をスクロールしたいと思っています。そのため、ボタンgetChildStaticTransformation
のイベントからメソッドを呼び出しています。onTouch
でも絵は動かない。
コードは次のとおりです。
私が使用したクラスのコンストラクターでは、
this.setStaticTransformationsEnabled(true);
そのため、画面をスクロールすると、以下のメソッドがすべて自動的に起動されます。しかし、ボタンクリックでメソッドを使用したいのですが、ボタンクリック内で明示的にこのメソッドを呼び出してみましたが、機能していません。
protected boolean getChildStaticTransformation(View child, Transformation t) {
final int childCenter = getCenterOfView(child);
final int childWidth = child.getWidth();
int rotationAngle = 0;
t.clear();
t.setTransformationType(Transformation.TYPE_MATRIX);
if (childCenter == mCoveflowCenter) {
transformImageBitmap((ImageView) child, t, 0);
} else {
rotationAngle = (int) (((float) (mCoveflowCenter - childCenter) / childWidth) * mMaxRotationAngle);
if (Math.abs(rotationAngle) > mMaxRotationAngle) {
rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle
: mMaxRotationAngle;
}
transformImageBitmap((ImageView) child, t, rotationAngle);
}
return true;
}
私を助けてください。