How to change the height of a view

by jdekeij » Wed, 11 Nov 2009 03:53:08 GMT

Sponsored Links
 I use the following layout to define a gameboard.

<LinearLayout xmlns:android=" 

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

Jasper de Keijzer


How to change the height of a view

by RichardC » Wed, 11 Nov 2009 04:06:46 GMT

 I can answer 1/2 your question

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.



Sponsored Links

Other Threads

1. Test Kecepatan PUSH MAIL dari 3 Provider pada 3 Handset Berbeda dengan 2 Operating Sytem yang berbeda pula.

Test kecepatan PUSH MAIL dari 3 Provider dan 3 Handset, dengan
melakukan pengiriman email :

1. Sony Ericsson X10i Firmware 1.6 Official Provider Telkomsel Simpati
(Flash Quote 400mb/bln) = 10 - 20 detik sampe setelah pengiriman.
2. HTC Magic 32A Firmware 2.1 Hero Sense Provider Indosat IM3 (Paket
Data 125mb/bln) = 3 - 8 detik sampe setelah pengiriman.
3. Samsung Omnia Pro b7730 Windows Mobile Smartphone 6.5 Standard
Provider XL (Paket Data 50mb/bln) = 1 - 3 detik sampe setelah

Uji coba dilakukan 5 - 10 kali ngirim email....

kira-kira yang mempengaruhi tuh Provoder? Handset? ato Firmware dan
Operating System?

"Indonesian Android Community [id-android]" 

2. Binding Json Array to Adapter


I have retrieved Json array by using the process below...

Now, I am trying to display the Json array in a list view.
So, can anyone help me determine how can i bind the values obtained
from Json array to a adapter so that i can display them in a list
view...I want to only display the text and the date of each value of
the array...


3. JIT compiler explanation

4. Third party firewall/antiviru

5. OpenSSL JCE Provide

6. opencore test for 3gp file play

7. Finally, I published my Android/GAE based MMO War Game