How to customize ListView with ToggleButtons

I am making an android application.I have ListView in it which contains four rows having textView i.e Hide Unhide Add Users Delete users I want to add ToggleButton in ListView for first two rows but don n't want to show it for other rows. How can i customize my ListView in this way. Any help will be appreciated

Answers


You have to write a custom BaseAdapter. There you have the method getView() that is called for each listItem, so this is the right palce to define the layout of the listItems.

Please look at this article to ensure a smooth scrolling of your list.

And you can find a good Tutorial on Vogellas site.


If you want to add toggle button for first two rows only and not for all rows then one easy thing you can do is add in the custom listview layout file both the textview and toggle button but while implementing add (null) in the toggle button's place in the adapter for the rows for which you don't want the toggle button...


Need Your Help

What is purpose of exportProperty function in knockout.js library?

javascript knockout.js

I am reading knockout.js library source codes and i saw such as function calls

Aligning html input and submit

html css positioning

I am having a ridiculous problem where my input text field and submit buttons are not lining up and I really can't figure out an elegant solution of how to fix it. As you can see in the image below...