• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps AbsoluteLayout is deprecated ????

aryaxt

Newbie
it says "AbsoluteLayout is deprecated"
but the code works fine.
is there another way to do such a thing without getting this warning?
Should i ignore the warning?
Code:
AbsoluteLayout l = (AbsoluteLayout)findViewById(R.id.layout);
l.addView(myCustomButtonOnRunTime);
 
This forum is USELESS
Why? Because you don't get an answer to your very specific and expertise-requiring question within one hour?

I'd say that as long as it compiles, ship it! It may not work on the newest devices, but it should work on older devices.
 
Thanks for the answer,
the iphone dev forum i used before was a lot faster.
I think a developer forum should be separated from a general forum, that might be why.
 
Either ignore the deprecation or use another layout container. A RelativeLayout will do just about anything an AbsoluteLayout will, without relying on positioning using screen pixels.
 
Thanks, i actually switched all my forms from RelativeLayout to AbsoluteLayout
But 1 question is it possible to add for example a button to the AbsoluteLayout at runtime, and specify a certain x and y for it?
Based on my understanding in RelativeLayout each object doesn't have it's own possition (x and y), on the screen, and the location of each object can only be based on another object.
Am i wrong?
 
You're not wrong. You can still define margins and padding for elements within a RelativeLayout, but that sort of misses the point.

If you really need absolute positioning, use an AbsoluteLayout and ignore the deprecation warnings.
 
Thanks again for the answer, 1 more thing. Is there any way i can find out if AbsoluteLayout will be removed from the sdk or not?
From my understanding deprecated classes will get removed at one point.
 
Back
Top Bottom