New to Android - simple View question

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

New to Android - simple View question

Postby Olannon » Wed Jan 27, 2010 10:57 am

Hello all, I'm new to Android and I have a simple question:

I want to make a view (I suppose LinearLayout or RelativeLayout are good candidates) including 2 textviews aligned vertically (so one is beneath the other). This is no problem, however when I click my mouse, I want the 2 textviews to change position so that the one on top ends up at the bottom and vice versa. As of yet I have not seen any clear and easy way to do this, I've tried around with gravity, alignment etc but I can't make it work.

Suggestions and answers very much appreciated :)
Olannon
Freshman
Freshman
 
Posts: 6
Joined: Wed Jan 27, 2010 10:54 am

Top

Postby grzegorz.zajac » Wed Jan 27, 2010 11:08 am

Hello,

Isn't it easier to replace the contents (text value and/or view properties like color, size, etc.) of the TextViews?

If you really need to replace the TextViews itself, try with Table Layout. Define two rows and programatically assign proper text view to each of them.

Regards,
Grzesiek
grzegorz.zajac
Developer
Developer
 
Posts: 39
Joined: Wed Feb 18, 2009 8:37 pm
Location: Krakow/Poland

Postby Olannon » Wed Jan 27, 2010 11:11 am

It probably would be easier to swap the texts, true, however I need to be able to swap the views - for example they could be images instead of textviews :)

How would you do this with tableview? What methods can you use to change the views dynamically during runtime?
Olannon
Freshman
Freshman
 
Posts: 6
Joined: Wed Jan 27, 2010 10:54 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests