I can answer 1/2 your question

Jasper de Keijzer wrote:
>and make it square

You need to implement onMeasure  in your custom view class and call
setMeasuredDimension when you have calculated the largest square your
want your custom view to occupy.

Centering a view in its parent container I do not know how to do.

--
RichardC

On Nov 10, 7:52 pm, jdekeij <[email protected]> wrote:
> I use the following layout to define a gameboard.
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
>     <gomoku.com.BoardView
> android:id="@+id/gomoku"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"/>
> </LinearLayout>
>
> All works fine, however I want the gameboard to appear as square. So I
> need to resize the board at runtime to put it in the center of the
> screen and make it square. I tried many options without success :(
>
> Help is very much appreciated
>
> Thanks,
> Jasper de Keijzer

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