Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i move my layout via accelerometer sensor?
    primarykey
    data
    text
    <p>I've two <code>AbsoluteLayout</code> are called <code>Background_layout</code> and <code>Foreground_layout</code> in one base XML.</p> <p>I wanna move first layout (<code>Background_layout</code>) through the accelerometer sensor for direction Y X Z , How can i do that?</p> <p>Here you can see my XML :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/background_layout" android:background="@drawable/background" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;AbsoluteLayout android:id="@+id/foreground_layout" android:layout_height="wrap_content" android:background="@drawable/foreground" android:layout_width="wrap_content" android:layout_x="0dip" android:layout_y="0dip"&gt; &lt;/AbsoluteLayout&gt; &lt;/AbsoluteLayout&gt; </code></pre> <p>I have all the values about direction , But I don't know How can I use them in layout view.</p> <pre><code> public void onSensorChanged(int sensor, float[] values) { synchronized (this) { if (sensor == SensorManager.SENSOR_ACCELEROMETER) { float ValuX = (float) values[0]; float ValuY = (float) values[1]; float ValuZ = (float) values[2]; int ResValuX = new Integer(Float.toString(ValuX)); int ResValuY = new Integer(Float.toString(ValuY)); int ResValuZ = new Integer(Float.toString(ValuZ)); Background.addView(Background,ResValuX); Background.addView(Background,ResValuY); Background.addView(Background,ResValuZ); } } } </code></pre> <p>Any suggestion would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload