Basically I want a list view(CheckBox and TextView) that has all the data from a database but the first item in the view always being "ALL".I have done loading listadapter but i don't know how to add first row as All. If I am clicking All checkebox.I want to other check开发者_运维问答box's state as false. my code as follow..
Why don't you do it like this?
You get position in getview()
, then for the first item add condition. Something like this:
if(position == 0)
youTextView.setText("All");
That's it.
you can add HeaderView in ListView
here is simple code of How to add HeaderView in ListView.
LayoutInflater inflater = getLayoutInflater();
LinearLayout listHeaderView = (LinearLayout)inflater.inflate(
R.layout.headerview, null);
ListView.addHeaderView(listHeaderView);
create headerview.xml and you can add in this layout TextView with "ALL" text.
精彩评论