android - Set drawable image as background on custom view -


i'm creating map application , want know how add map-image background, able draw text on it. want create custom view class extends view, add background , override ondraw-method.

my idea use constructor add background image, image deciding size of custom view. can use coordinates draw text @ positions on image.

hank

you can use property of extended view in constructor of custom class. can assign background in constructor.

like way..

public class testview extends view{      public testview(context context, attributeset attrs, int defstyle) {         super(context, attrs, defstyle);          // todo auto-generated constructor stub         setbackgroundresource(r.drawable.your_drawable);           }       } 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -