I made my UI with .xml, But I want to give the direction of the Button by dynamically. For Example;

 <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <Button 
         android:id="@+id/backbutton"
         android:text="TEST123"
         android:layout_x="120px"
         android:layout_y="120px"
         android:layout_width="100px"
         android:layout_height="100px" />
    </AbsoluteLayout>

Then is my activity class I changed something by dynamically like that.

    AbsoluteLayout al = new AbsoluteLayout(this);
    Button t = new Button(this);
    t.setHeight(300);
    t.setWidth(300);
    t.setText("TEST123");
    // x y ???
    setContentView(al);

I've changed the height and width..but I couldn't find the way to changed x and y directions.

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top