How to create custom widget in android -
i working on birthday wish app. want create set reminder of friends birthday on main screen of mobile. want view of custom widget. can me how create widget in android dynamically? using coding.
public class dynamicimagebutton extends imageview { public dynamicimagebutton(final context context, final attributeset attrs) { super(context, attrs); } @override protected void onmeasure(final int widthmeasurespec, final int heightmeasurespec) { final drawable d = this.getdrawable(); if (d != null) { // ceil not round - avoid thin vertical gaps along left/right edges final int width = measurespec.getsize(widthmeasurespec); final int height = (int) math.ceil(width * (float) d.getintrinsicheight() / d.getintrinsicwidth()-10); this.setmeasureddimension(width, height); } else { super.onmeasure(widthmeasurespec, heightmeasurespec); } } } 
Comments
Post a Comment