android - Get standard layout attributes -
i extended class imageview , added custom parameters. succeed these custom parameters code, using method context.gettheme().obtainstyledattributes()
.
what need access standard parameters of imageview object, such android:src
, android:background
. know exist class android.r.styleable.* use parameters, class has been deprecated (and not visible anymore). can access android parameters?
while i’m not sure how extract parent values typedarray
, you’re able access them appropriate getters, e.g.:
public class myimageview extends imageview { public myimageview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); final typedarray array = getcontext().obtainstyledattributes(attrs, r.styleable.whatever); try { // custom attributes here } { array.recycle(); } // parent attributes final drawable background = getbackground(); final drawable src = getdrawable(); // etc. } }
it's not you're looking for, might help.
Comments
Post a Comment