1. Download our Official Android App: Forums for Android!

Apps AbsoluteLayout is deprecated ????

Discussion in 'Android Development' started by aryaxt, Jun 14, 2010.

  1. aryaxt

    aryaxt Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    21
    Joined:
    Jun 1, 2010

    Jun 1, 2010
    21
    0
    15
    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 (Text):
    1. AbsoluteLayout l = (AbsoluteLayout)findViewById(R.id.layout);
    2. l.addView(myCustomButtonOnRunTime);
     

    Advertisement

  2. aryaxt

    aryaxt Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    21
    Joined:
    Jun 1, 2010

    Jun 1, 2010
    21
    0
    15
  3. KlaymenDK

    KlaymenDK Android Expert
    Rank:
    None
    Points:
    143
    Posts:
    1,217
    Joined:
    May 29, 2009

    May 29, 2009
    1,217
    130
    143
    Denmark
    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.
     
  4. aryaxt

    aryaxt Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    21
    Joined:
    Jun 1, 2010

    Jun 1, 2010
    21
    0
    15
    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.
     
  5. dmitriyk

    dmitriyk Member
    Rank:
    None
    Points:
    18
    Posts:
    44
    Joined:
    Apr 17, 2010

    Apr 17, 2010
    44
    10
    18
    Software Developer
    Salt Lake City, UT
    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.
     
  6. cp1

    cp1 Android Enthusiast
    Rank:
    None
    Points:
    53
    Posts:
    375
    Joined:
    Apr 30, 2010

    Apr 30, 2010
    375
    35
    53
    Is there a way to ignore the OP? I can't find it by clicking on his name.
     
  7. aryaxt

    aryaxt Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    21
    Joined:
    Jun 1, 2010

    Jun 1, 2010
    21
    0
    15
    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?
     
  8. dmitriyk

    dmitriyk Member
    Rank:
    None
    Points:
    18
    Posts:
    44
    Joined:
    Apr 17, 2010

    Apr 17, 2010
    44
    10
    18
    Software Developer
    Salt Lake City, UT
    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.
     
    aryaxt likes this.
  9. aryaxt

    aryaxt Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    21
    Joined:
    Jun 1, 2010

    Jun 1, 2010
    21
    0
    15
    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.
     
  10. kevin@teslacoilsw

    kevin@teslacoilsw Well-Known Member
    Rank:
    None
    Points:
    68
    Posts:
    183
    Joined:
    Jun 13, 2010

    Jun 13, 2010
    183
    130
    68
    WidgetLocker developer
    Chicago
    aryaxt likes this.

Share This Page

Loading...