I want some tips in how to complete one task.
We got three EditTexts, a button and a llistview.
The idea here is when the button is pressed, the texts from the three EditTexts will be show in a listview, side by side, giving the impression that we got a table here.
The problem here is I don’t know how to do it. I’ve tried to search something on the net, but I just got nothing.
I’d really appreciate if you could help.
Thaks for the attention and have a nice day.
There are a couple ways to achieve what you want. If I’m understanding correctly you have a listview and a button. When you click the button, you want 3 editTexts to appear in your listview side by side so that it looks like a table.
The simplest solution is have your list item layout, inflated in your listadapter, simply be a linearlayout with weightSum=”3″ containing 3 edittexts with layout_weight=”1″ and layout_width=”0dp”
so your list_item.xml would look something like:
Then, in the onClick for your button, iterate through the children of the list row and set the visibilities to visible.
As for adding rows dynamically, use a listadapter and a collection and use the notifydatasetchanged to update the list when your collection gains/loses items.