8

このアプリのスナップショットをご覧ください。

ここに画像の説明を入力してください

これは銀行のアプリケーションです。銀行のロゴの周りに6つのボタンがあります。画像の1つをクリックアンドホールドして画像を回転させ、指をいずれかの方向(時計回りまたは反時計回り)に動かすことができます。したがって、たとえば、それらを回転させて、Currency Convertor画像の代わりに画像を配置することができLoginます。

私のアプリには6つの画像もありますが、それらを回転させたいと思います。どうやってやるの?

更新:ところで、これはiPhoneアプリですが、iOS固有の問題ではないと思います。

4

2 に答える 2

0

Assuming you don't need to change the items in the "menu" (enable/disable/order/visibility) you can probably "cheat" by having a bitmap with the items pre-drawn as required and rotating the bitmap. The image over the top and background etc can be done by "layering" the images, so..

  1. you have a background image (probably the "bevel" around the dial) which you draw first..
  2. you then rotate your dial image to place your menu option where you want it (transparent anywhere you want the background to be seen..) and draw it over the background
  3. you then draw your pointer image over the dial (again, transparent anywhere you want the dial and background to be seen).

    • the end result would (in theory) look very much like your screenshot.

on Android you would probably do this on an off-screen bitmap so the user doesn't see the image being built, then draw the entire finished bitmap. On iOS, offscreen buffering is mostly automatic, so you probably don't need to worry about it.

..アイテムの状態を変更したい場合は、よりトリッキーになります..アイテムの画像(セグメント画像として)を回転させずにダイヤルを「構築」し、「構築された」ダイヤルを回転させて描画します。

私は個人的に文字盤の影を別のレイヤーとして表示します (ステップ 2.5 になります)。部分的に透明なビットマップを使用して影の領域を薄暗くします。影が正しい場所にとどまるため、回転がより説得力のあるものになります..

于 2015-01-09T21:31:12.713 に答える
0

これをするだけ

RotateAnimation rAnim = new RotateAnimation(0, 359, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rAnim.setDuration(1000);
image.startAnimation(rAnim);
于 2013-11-18T14:09:09.053 に答える