multiple choice list, made out of a table

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

multiple choice list, made out of a table

Postby darolla » Tue Feb 03, 2009 1:29 pm

hi,

please don't ask me why I need to do this, but I need the following:

a scrollview with a tablelayout and instead of each tablerow I have a linearlayout with an imageview an a textview.

each tablerow should be able to be pressed. then the image of the imageview has to change (checked, unchecked).

well, the layout is done and working fine for me (the linearlayout has a backgroudn with different states using selector, so it feeld like a button).

now I have to add the onclicklisteners.

well, using ids isnt that hard.

linearlayout1 gets the eventlistener, imageview1 gets changed.
linearlayout2 gets the eventlistener, imageview2 gets changed.
linearlayout3 gets the eventlistener, imageview3 gets changed.
linearlayout4 gets the eventlistener, imageview4 gets changed.
...

I think this "hardcoded" ids sucks.

isnt there another way to do this, more elegant?

something like the DOM in javascript? like this:

ll = tablelayout.getchildren[17] <- this is the 17th linearlayout in the tablelayout
ll.getchildren[0] <- this is the imageview

greetings,
darolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests