android - How to add a subitem in this list activity? -
i wanna add subitem every list item.i working on app uses swipey tabs in 1 tab there list , following code list wanna add subitem text every list entry how can that.
public class fragmentcommandlist extends sherlockfragmentactivity{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // create list fragment , add our sole content. if (getsupportfragmentmanager().findfragmentbyid(android.r.id.content) == null) { arraylistfragment list = new arraylistfragment(); getsupportfragmentmanager().begintransaction().add(android.r.id.content, list).commit(); } } public static class arraylistfragment extends sherlocklistfragment { public static string[] data = {"first", "second", "third"}; @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); setlistadapter(new arrayadapter<string>(getactivity(), android.r.layout.simple_list_item_1, data)); } @override public void onlistitemclick(listview l, view v, int position, long id) { log.i("fragmentlist", "item clicked: " + id); } }
}
you can try change listfragment fragment expandable listview
. example:
http://www.mysamplecode.com/2012/10/android-expandablelistview-example.html
and this:
http://androidtrainningcenter.blogspot.co.il/2012/07/android-expandable-listview-simple.html
another option have design layout of single item of listview
in way allow extend. harder implement because of fact listview
views
recycled.
Comments
Post a Comment