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

Apps XML Layouts Help

Discussion in 'Android Development' started by RozzaC, Apr 17, 2009.

  1. RozzaC

    RozzaC Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    83
    Posts:
    647
    Joined:
    Feb 25, 2009

    Feb 25, 2009
    647
    10
    83
    Student
    London, UK
    Are XML layouts editable through java classes?

    I'm trying to mess around with the Android 1.5 SDK in Eclipse.

    I'm working with the TableLayout Tutorial...

    So far...I've designed my own TableLayout with 2 TableRows...all set up in my layout/main.xml file.

    I've used my java class to create a TextView object...which works fine...

    And I want to try and get it to display in one of the TableRows I've created in my XML file.

    How would you go about doing that? x.x

    I hope that makes sense....

    If you want my code...I'll send it over to you...

    Thanks....
     

    Advertisement

  2. RozzaC

    RozzaC Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    83
    Posts:
    647
    Joined:
    Feb 25, 2009

    Feb 25, 2009
    647
    10
    83
    Student
    London, UK
    I managed to figure out what I needed to do to change the XML layout....although it's a little long winded, so I'm not sure if it's the most effective option...

    What I did was:

    - Make a new instance of whatever it is you want to change about the layout using the associated ID within the XML template...(a TextView for example)

    - Make the changes necessary to the new instances

    So far...all I learned is...it's pretty complicated to change a XML layout....so I most likely won't be doing that again... -_-

    ---EDIT---
    Actually...it's not all that long-winded....I realised...I can do it in 2 lines instead the 7 or 8 I had before.. XD

    I don't think you would be able to understand anything I've just written, so if you would like me to post my code up here...then I'll do that...

    Roz
     

Share This Page

Loading...