Here is the code snippet of the C'tor:
 public class CanvasLayout extends FrameLayout
    {
        public CanvasView canvasView;

        public CanvasLayout(Activity context)
        {
                super(context);
//              setFocusableInTouchMode(true);

                canvasView = new CanvasView(context);
                canvasView.setFocusableInTouchMode(true);
                addView(canvasView);

                editControl = new MyEditText(context);
                editControl.setBackgroundColor(Color.GREEN);
                editControl.setVisibility(EditText.GONE);
                editControl.setPadding(0, 0, 0, 0);
                editControl.setFocusableInTouchMode(true);
                FrameLayout.LayoutParams params = new
FrameLayout.LayoutParams(0, 0,Gravity.TOP|Gravity.LEFT);
                params.setMargins(0, 0, 0, 0);
                editControl.setLayoutParams(params);
//              addView(editControl);
                context.addContentView(editControl, params);
        }


Basically i didn't have to create my own layout, it allowed later on
to use it's onSizeChnaged but basically i don't have to.

On Feb 18, 1:15 pm, skink <[email protected]> wrote:
> poohtbear wrote:
> > EditText and Canvas View are both created in the FrameLayout's C'tor
> > (sorry i forgot to to mention it's my own class inheriting from
> > FramLayout and not the original).
> > The first LAyoutParams i give EditText are w:0 h:0 x:0 y:0, each time
> > on resize is called and the item that the EditText is bounded to
> > changes it's size i take that size and set it in the margins and width
> > and height of the layoutParams.
> > The FramLayout is created in onCreate and added with setContentView()
>
> > On Feb 18, 12:26 pm, skink <[email protected]> wrote:
> > > On Feb 18, 10:43 am, poohtbear <[email protected]> wrote:
>
> > > > the hirarchy ?
> > > > It's created in runtime
>
> > > > FramLayout
> > > >        |
> > > >        -------------CanvasView(extends view) - responsible for drawing
> > > > our UI, overrides onSizeChanged and onDraw.
> > > >        |
> > > >        ------------- EditText, used for binding our UI's focused
> > > > textFields to android's.
>
> > > > So when resize happens:
> > > > 1. FrameLayout onMeasure is called.
> > > >    1.1 CanvasView onMeasure is called.
> > > >    1.2 EditText onMeasure is called <-- problem since new LayoutParams
> > > > are not set yet!
> > > > 2. onLayout called on FrameLayout <-- here the FramLayout will use the
> > > > meausredWidth of Edit Text to lay it out.But the size is wrong
> > > > 3. onSizeChanged is called on FrameLayout and CanvasView <--- here the
> > > > new LayoutParams are set for EditText.
>
> > > > what i need is step no 4: cause onMeasure to be called again, at least
> > > > on EditText and onLayout for FrameLayout, can't manage to do it.
>
> > > ok, when at runtime, you create EditText, how you add it to
> > > FrameLayout?
>
> > > i mean what LayoutParams does your EditText have?
>
> > > pskink
>
> can you post some code snippet how you add children to your custom
> FrameLayout?
>
> and why did you have to create your custom FrameLayout?
>
> pskink

-- 
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