2010-07-24 3 views

ответ

3

Использование LinearLayouts и установка детей на fill_parent как по ширине, так и по высоте и присвоение им одного и того же layout_weight вы получите желаемый эффект:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_weight="1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <Button 
      android:text="Button 1" 
      android:layout_weight="1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"></Button> 
     <Button 
      android:text="Button 2" 
      android:layout_weight="1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"></Button> 
     <Button 
      android:text="Button 3" 
      android:layout_weight="1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"></Button> 
    </LinearLayout> 
    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_weight="1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <Button 
      android:text="Button 4" 
      android:layout_weight="1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"></Button> 
     <Button 
      android:text="Button 5" 
      android:layout_weight="1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"></Button> 
     <Button 
      android:text="Button 6" 
      android:layout_weight="1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"></Button> 
    </LinearLayout> 
</LinearLayout> 
+0

awesome thank you =) –

Смежные вопросы