android - SwipeRefreshLayout works but the spinner won't show -
i'm having issue using swiperefreshlayout, functionality works spinner won't show. i've used provided solutions out there still nothing.
i don't use xml @ code , avoid it. have class extending swiperefreshlayout create listview, add adapter , configure refresh action etc. minimum api level 16.
if guys need further details or code please let me know , i'll glad provide them, appreciated!
my activity
public class mainactivity extends activity { private static mainactivity mainactivity = null; private mainview mainview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mainview = new mainview(this); setcontentview(mainview); } public static mainactivity getmainactivity() { return mainactivity; } } my main view:
public class mainview extends swiperefreshlayout { private listview listview; public mainview(context context) { super(context); final string [] objects = new string[] {"panda", "horse", "fox"}; listview = new listview(context); final arrayadapter arrayadapter = new arrayadapter<string>(context, android.r.layout.simple_list_item_1, objects); listview.setadapter(arrayadapter); addview(listview); this.setonrefreshlistener(new onrefreshlistener() { @override public void onrefresh() { objects[0] = "big panda!"; arrayadapter.notifydatasetchanged(); setrefreshing(false); } }); } @override protected void onlayout(boolean changed, int l, int t, int r, int b) { int width = r - l; int height = b - t; listview.layout(0, 0, width, height); } }
hard tell without seeing code, gut tells me need make sure appropriate progress view linked , setting visibility visible , invisible @ right times.
Comments
Post a Comment