>         MyCustomView customView = new MyCustomView(this);
>         // Settings here the margin : Doesn't works!
>         MarginLayoutParams mLayoutParams = new MarginLayoutParams(338,
> 338);
>         mLayoutParams.setMargins(100, 100, 0, 0);
>         customView.setLayoutParams(mLayoutParams);
>         mainLayout.addView(customView, 0, mLayoutParams);

Replace with the following codes and you will find the custom view on
the right position:

        // for testing only
        MyCustomView customView = new MyCustomView(this);
        RelativeLayout.LayoutParams layoutParam = new
RelativeLayout.LayoutParams(100, 100);
        layoutParam.setMargins(100, 100, 0, 0);
        mainLayout.addView(customView, 0, layoutParam);

BTW, for specified width and height of this custom view, you need to
check the View.onMeasure()  method.

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

Reply via email to