Android - ExpandableListView isn't showing the groupIndicator icon -
i have expandablelistview in xml , i'm setting adapter custom baseexpandablelistadapter. xml:
<expandablelistview android:id="@+id/expanlist_estatisticaarsenal" android:divider="@null" android:layout_width="fill_parent" android:layout_height="fill_parent" android:transcriptmode="alwaysscroll" android:cachecolorhint="#000000" android:listselector="@android:color/transparent" android:visibility="gone"> </expandablelistview>
android:visibility="gone"
because make visible after stuff
adapter custom class:
public class adapter_expanestatistica extends baseexpandablelistadapter { private context c; private list<blocoarsenal> listblocos; public adapter_expanestatistica(context ctx, list<blocoarsenal> listblocos) { c = ctx; listblocos = listblocos; } @override public view getchildview(int groupposition, int childposition, boolean islastchild, view convertview, viewgroup parent) { // todo auto-generated method stub layoutinflater inflater = (layoutinflater) c.getsystemservice(context.layout_inflater_service); view expdanableview = inflater.inflate(r.layout.estatistica_expanlist_child, null); /* here populate tablelayout exists in expdanableview info */ return expdanableview; } @override public int getchildrencount(int groupposition) { // todo auto-generated method stub return 1; } @override public int getgroupcount() { // todo auto-generated method stub return listblocos.size(); } @override public long getgroupid(int groupposition) { // todo auto-generated method stub return groupposition; } @override public view getgroupview(int groupposition, boolean isexpanded, view convertview, viewgroup parent) { // todo auto-generated method stub layoutinflater inflater = (layoutinflater) c.getsystemservice(context.layout_inflater_service); view expdanableview = inflater.inflate(r.layout.estatistica_expanlist_parent, null); textview txt = (textview) expdanableview.findviewbyid(r.id.txtnomebloco); txt.settext(listblocos.get(groupposition).getnome()); return expdanableview; } @override public boolean hasstableids() { // todo auto-generated method stub return true; } @override public boolean ischildselectable(int arg0, int arg1) { // todo auto-generated method stub return false; }
xml childview:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <tablelayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tblestasticaarsenal" > </tablelayout> </linearlayout>
xml parentview:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:id="@+id/txtnomebloco" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="3dp" android:layout_marginright="3dp" android:layout_margintop="3dp" android:textcolor="#5e302a" android:text="nome bloco" android:textappearance="?android:attr/textappearancesmall" /> </linearlayout>
when set adapter of expanlistview , change visibility visible, goes ok, doesn't show groupindicator icon. can me?
in method getgroupview try use layout - android.r.layout.simple_expandable_list_item_2
as result, code this:
@override public view getgroupview(int groupposition, boolean isexpanded, view theconvertview, viewgroup parent) { view row = theconvertview; textview textview; if(theconvertview == null) { row = inflater.inflate(android.r.layout.simple_expandable_list_item_2, null); textview = (textview)row.findviewbyid(android.r.id.text2); row.settag(textview); } else { textview = (textview)theconvertview.gettag(); } //textview.settext(); //todo set group return row; }
if can see method diferrent your. used viewholderpatter, read (this code work better).
i checked it, in group mas indicator.
hope, you.
Comments
Post a Comment