android: moving shape/image with values from accelerometer
问题 ive managed to get out the accelerometers values (x,y,z). Is there an easy way to make a circle move with those values? I would also like it to stop at the edges of the screen. Thanks! 回答1: I think you can do something like this ( note: partially pseudocode): public void onSensorChanged (int sensor, float[] values) { //adjust someNumber to desired speed //values[1] can be -180 to 180 float xChange = someNumber * values[1]; //values[2] can be -90 to 90 float yChange = someNumber * 2 * values[2