goal:
changing actionbar's overflow item icon color. new icon should input via svg.
state:
note overflow icon replace refresh icon examine size differences. replaced overflow icon later. both icons loaded using same method, same parameter, same .svg file.
use svg-android-2 .svg loading , rendering. 
modification code:
please don't discuss danger of using reflective code before having solved problem :)
// http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2.2_r1/com/android/internal/app/actionbarimpl.java/ private void hackoverflowicon() { actionbar actionbar = getactionbar(); if (actionbar.getclass().getname().equals("com.android.internal.app.actionbarimpl")) { try { field actionbarviewfield = actionbar.getclass().getdeclaredfield("mactionview"); actionbarviewfield.setaccessible(true); object actionbarview = actionbarviewfield.get(actionbar); field actionmenuviewfield = actionbarview.getclass().getsuperclass().getdeclaredfield("mactionmenupresenter"); actionmenuviewfield.setaccessible(true); object actionmenu = actionmenuviewfield.get(actionbarview); field overflowviewfield = actionmenu.getclass().getdeclaredfield("moverflowbutton"); overflowviewfield.setaccessible(true); imagebutton overflowview = (imagebutton) overflowviewfield.get(actionmenu); drawable drawable=svgutils.getdrawablefromraw(this, r.drawable.refresh, new rectf(0, 0, 120, 120)); overflowview.setimagedrawable(drawable); } catch (nosuchfieldexception e) { e.printstacktrace(); } catch (illegalaccessexception e) { e.printstacktrace(); } catch (nullpointerexception e) { e.printstacktrace(); } } else throw new illegalstateexception("actionbar instance of " + actionbar.getclass().getname()); } question:
why icons have different sizes , how can prevent size changes?
thanks reading , on problem,
till
Comments
Post a Comment