1

だから私はイメージビューでいくつかの回転と翻訳を行っています。私が理解しているように、これらのいずれかの後、イメージビューは本当に新しい場所にあるわけではなく、アニメーションが完了した後に実際にそこに移動する必要があります。したがって、移動しようとしているイメージビューはトークンと呼ばれ、元の位置に設定され、token.getLocationOnScreen( tokenPos );開始位置があります。resetToken移動または翻訳の後、移動または回転を処理するために呼び出します。これは、半分の時間で目的の結果を達成しているようです...何が間違っているのかわかりませんが、私が望む方向に向いていることとは矛盾しています。

public void resetToken() {   
    //Decode Image using Bitmap factory.
    Bitmap bMap = Bitmap.createBitmap(token.getDrawingCache());

    Matrix matrix = new Matrix();
    matrix.postRotate(0);

    //move the token to the spot it needs to be in
    //after an animation the token is not really
    //in the new spot
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(token.getWidth(), token.getHeight());
    lp.setMargins(tokenPos[0], tokenPos[1], 0, 0);

    //Create bitmap with new values.
    Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, token.getWidth(), token.getHeight(), matrix, true);
    token.setImageBitmap(bMapRotate);
    token.setLayoutParams(lp);
    //put rotated image in ImageView.


    moveCounter = moveCounter + 1;

}
4

1 に答える 1