can we use layout in Customview ?
        Posted  
        
            by UMMA
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by UMMA
        
        
        
        Published on 2010-06-17T12:32:26Z
        Indexed on 
            2010/06/17
            12:43 UTC
        
        
        Read the original article
        Hit count: 227
        
android
friends,
i have a custom view class
public class Zoom extends View {
        private Drawable image;
        private int zoomControler=20; 
        public Zoom(Context context)
        {
            super(context);
            image=context.getResources().getDrawable(R.drawable.icon);
            setFocusable(true);
        }
        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            //TransparentPanel tp = new TransparentPanel(this.getContext());
            //Button MyButton = new Button(this.getContext());
            //MyButton.setText("Press me");
            //tp.addView(MyButton);
            image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler);
            image.draw(canvas);
        }
}
can i use SetContentView(R.layout.mylayout) in this custom view to display that design?
or
how can i display button with image ondraw method as i have commented the code ?
any help would be appreciated.
© Stack Overflow or respective owner