I am creating a custom widget that is a composition of 3 Buttons. I
want to reposition the buttons as I am doing in my code, however this
doesn't work. Basically I am trying to create a widget that has three
buttons positions somewhere in the middle of the screen.

Any ideas?

My code looks like this:

public class ZoomControl extends LinearLayout {

        private Button zoomIn;
        private Button zoomOut;
        private Button magnify;

        public ZoomControl(Context context) {
                this(context, null);
        }

        public ZoomControl(Context context, AttributeSet attrs) {
                super(context, attrs);
                init(context);
        }

        private void init(Context context) {

        LayoutInflater inflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.zoomcontrol, this, true);

        // get handles to views
        zoomIn = (Button) findViewById(R.id.zoomIn);
        zoomOut = (Button) findViewById(R.id.zoomOut);
        magnify = (Button) findViewById(R.id.zoomMagnify);

        // reposition views
        zoomIn.offsetLeftAndRight(200);
        zoomIn.offsetTopAndBottom(200);
        requestLayout();

        }

        public void dispatchDraw(Canvas canvas) {
        }
}



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to