English 中文(简体)
视用户在屏幕上的触角而轮流图像
原标题:rotate image depending on user touch on screen
  • 时间:2010-11-11 09:30:53
  •  标签:
  • android

i 正在开发游戏,一 显示屏幕底部的枪支中心。 当用户在屏幕上抽取时,需要朝此方向轮换枪支。 i 轮流图像。 但当用户在屏幕上抽取时,则需要对这一方向进行轮换。 请帮助我

预 收

Aswan

最佳回答

你们的形象是个蓝图吗? 你们可以把它变成一个? http://www.anddev.org/resize_and_rotate_image_-_example-t621.html”rel=“nofollow” http://www.anddev.org/resize_and_rotate_image_-_example-t621.html。

Seeing some code as to what you ve attempting would be nice also. The following will help you with checking if the bitmap has been clicked in case you re stuck on that also http://developer.android.com/reference/android/view/View.html . I ve never attemped this myself but I think that would work. Try redrawing the bitmap when you have resized it.

问题回答

公平使用Touch 名单 考虑和使用这一守则

     @Override
 public boolean onTouch(View v, MotionEvent event) {
    float currentX = event.getX();
    float currentY = event.getY();
    Log.i(TAG, "action type is"+event.getAction());
    switch (event.getAction()) {
    case MotionEvent.ACTION_MOVE: {
        Log.i(TAG, "Entering in onTouch");
        double rotationAngleRadians = Math.atan2(currentX - dialer.centerX,      dialer.centerY - currentY);
        dialer.rotationAngle = (int) Math.toDegrees(rotationAngleRadians);
        Log.i(TAG, "rotaion angle"+dialer.rotationAngle);
        dialer.invalidate();
        return true;
    }
    }
    return true;
}




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签