XML Layouts Help

Last Updated:

  1. RozzaC

    RozzaC Well-Known Member

    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...


  2. RozzaC

    RozzaC Well-Known Member

    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... -_-

    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...


Share This Page