Emulate Navigation Drawer Icon on Android ActionBar without Navigation Drawer -
i used slidinglayer library in android proyect , want emulate home button if used navigation drawer. using actionbar too, how this?
find blog post looks similar question
public void updatenavigationdrawericon(drawable drawable) { method sethomeasupindicator; try { sethomeasupindicator = actionbar.class.getdeclaredmethod("sethomeasupindicator", drawable.class); sethomeasupindicator.invoke(getactionbar(), drawable); } catch (nosuchmethodexception e) { log.e("check", "no such method"); view home = findviewbyid(android.r.id.home); viewgroup parent = (viewgroup) home.getparent(); int childcount = parent.getchildcount(); if (childcount == 2) { final view first = parent.getchildat(0); final view second = parent.getchildat(1); final view = first.getid() == android.r.id.home ? second : first; ((imageview) up).setimagedrawable(drawable); } } catch (exception e) { e.printstacktrace(); } }
all best
Comments
Post a Comment