アニメーションが異常な問題を引き起こす前に設定した正確な座標にとどまっているクリックリスナーを実行した後、アンドロイドで作成した翻訳アニメーションに問題があります。この問題の調査に数日を費やしましたが、まだ解決していません。私が見つけたいくつかの提案には、ターゲット開発レベルを 4.0 に変更し、myLayout.layout(x,x,x,x) を変更することが含まれていましたが、どちらもうまくいきませんでした。このコードを変更する方法についての提案はありません。クリックリスナーをレイアウトに合わせて移動するには?
upperView = (LinearLayout) findViewById(R.id.upperView);
hiddenMenu = (LinearLayout) findViewById(R.id.hiddenMenu);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
Integer width = metrics.widthPixels;
upperView.getLayoutParams().width = width;
hiddenMenu.getLayoutParams().width = (int) (width * 0.75);
int theDistance = hiddenMenu.getLayoutParams().width;
//Run animation
TranslateAnimation anim = new TranslateAnimation(0, theDistance - 0 , 0, 0);
anim.setDuration(1000);
anim.setFillAfter( true );
upperView.startAnimation(anim);