title: Changing button's position in Android
body: <p>My first question was to click through layout. I solved it out.</p>
  
  <p>Now my question is how to set button's position at desired location?</p>
  
  <p>My application's minimum api level is 8 (I can't set <em>getX()</em> or <em>getLeft()</em>)</p>
  
  <p>Test XML code:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt;
  &lt;Button android:id="@+id/buttonx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="X" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Acitivty code:</p>
  
  <pre><code>import android.app.*;
  import android.os.*;
  import android.view.*;
  import android.widget.*;
  
  public class Test extends Activity {
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL); requestWindowFeature(Window.FEATURE_NO_TITLE);
          setContentView(R.layout.test);
  
          Button xclose = (Button) findViewById(R.id.buttonx);
          xclose.setOnClickListener(new View.OnClickListener() {
              public void onClick(View arg0) {
                  finish();
              }
          });
      }
  }
  </code></pre>
  
  <p>any way to change button's position dynamically or programatically?</p>