What is the alternative to AbsoluteLayout in Android?
<p>I see posts saying that FrameLayout is the alternative, and that I should use margins to position things (this strikes me as wildly counter intuitive, but ok... if it works, I'll take it). However, I can't get it to work, so, I'm looking for assistance. </p>

<p>here's my code</p>

<pre><code>    FrameLayout layout = new FrameLayout(this);
    layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    Button btn = new Button(this);
    btn.setBackgroundResource(R.drawable.btn);

    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lp.setMargins(100,100,100,100);

    btn.setLayoutParams(lp);   //i've tried with and without this line, no change

    layout.addView(btn , lp);
</code></pre>

<p>The button is drawn at 0,0 no matter what I do.  When I change the lp's LayoutParam to FILL_PARENT the button is then stretched to take up the entire screen (which makes sense).</p>

<p>HOW do you get it to draw somewhere else on the screen, irrespective of what else is there? </p>

<p>As always, super grateful in advance.</p>

<p>[EDIT]
It seems my question isn't entirely clear (given the answers) so...</p>

<p>In the code above, the intent is to create a button, pass it to a layout and have it draw at 100,100 on the screen.</p>

<p>I'm aware of the fact that this may mean different things on different devices. I'm ok with that.  I simply need a way to, programatically, and at run time, place an item at a SPECIFIC location. I don't want to rely on gravity (or the laws of thermodynamics). I just want to specify a location and have the element appear there :)</p>
