我試圖根據用戶傾斜設備來進行ImageView移動。 我仍然在學習Android開發,所以我對傳感器知之甚少。 我試過使用這個,但我不確定後來該做什麼,但我猜測我在正確的軌道上。根據重力移動ImageView?
ImageView image = (ImageView) findViewById(R.id.image);
SensorManager mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Sensor mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
任何提示將幫助 謝謝!
非常感謝! 我會馬上試試 另一個問題,有沒有一種方法可以在Eclipse模擬器上進行測試?或者我將不得不在實際的電話上嘗試它? – Roy
@ user3097181更好地嘗試使用Device,否則您需要執行此操作http://code.google.com/p/openintents/wiki/SensorSimulator –