java - Showing CustomViews properly in Graphical Layout of android xml -
i have made simple custom textview. works fine in android device. on graphical layout of eclipse can see class name written instead of textview original text. how can test in eclipse graphical layout?
below code
public class mytextview extends textview { public mytextview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); init(); } public mytextview(context context, attributeset attrs) { super(context, attrs); init(); } public mytextview(context context) { super(context); init(); } private void init() { //if (!isineditmode()) { typeface tf = typeface.createfromasset(getcontext().getassets(), "helveticaltstd-bold.otf"); settypeface(tf); this.settextcolor(color.parsecolor("#ffd200")); this.setshadowlayer(1, 1, 1, color.black); } }
i had same problem custom fonts on custom textviews.
the graphical editor quite buggy , lacks many features work fine on real devices.
this 1 example of such thing.
in order fix , don't load fonts when isineditmode() returns true, , ignore how text looks like.
in fact, maybe shadow feature doesn't work well, might want add too.
Comments
Post a Comment