android - An always expanded MvxExpandableListView -
i'm trying develop version of mvxexpandablelistview expanded.
the code wrote seems work, i'm pretty sure don't things right way. tried find info android widgets lifecycle, found info activity lifecycle.
more specifically, should expandall() method called ? i've tried several places , ended putting ondraw() handler.
to prevent collapsing, called expandgroup() method in groupcollapse handler. hmm not sure it's right way either.
so, here code :
public class mvxexpandedlistview : mvxexpandablelistview { private bool _allexpanded = false; private void expandall() { var nbgroups = thisadapter.groupcount; (int = 0; < nbgroups; i++) { expandgroup(i); } } private void init() { groupcollapse += mvxexpandablelistview_groupcollapse; setselector(android.resource.color.transparent); cachecolorhint = color.transparent; setgroupindicator(null); } public mvxexpandedlistview(context context, iattributeset attrs) : base(context, attrs) { init(); } public mvxexpandedlistview(context context, iattributeset attrs, mvxexpandablelistadapter adapter) : base(context, attrs, adapter) { init(); } protected mvxexpandedlistview(intptr javareference, jnihandleownership transfer) : base(javareference, transfer) { init(); } void mvxexpandablelistview_groupcollapse(object sender, expandablelistview.groupcollapseeventargs e) { // there must better way... this.expandgroup(e.groupposition); } protected override void ondraw(canvas canvas) { base.ondraw(canvas); // ugly ! if (!_allexpanded) { expandall(); _allexpanded = true; } } public override bool collapsegroup(int groupposition) { return false; } }
thanks in advance help, kindanam
Comments
Post a Comment