2011-03-19 37 views
0

我開始學習一些Android開發,最近購買了一本初學者的書。第一章討論並構建一個數獨應用程序。我非常喜歡這個應用程序,但是當我來到一個窗口來顯示可能的數字進入一個正方形時,我搞砸了。這些按鈕在模擬器上顯示時非常小巧。這是鍵盤的xml:使用xml鍵盤的問題

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/keypad" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:orientation="vertical" 
    android:stretchColumns="*"> 
    <TableRow android:layout_height="wrap_content" android:layout_width="wrap_content"> 
     <Button android:text="1" 
      android:id="@+id/keypad_1"> 
     </Button> 
     <Button android:text="2" 
      android:id="@+id/keypad_2"> 
     </Button> 
     <Button android:text="3" 
      android:id="@+id/keypad_3"> 
     </Button> 
    </TableRow> 
    <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content"> 
     <Button android:text="4" 
      android:id="@+id/keypad_4" > 
     </Button> 
     <Button android:text="5" 
      android:id="@+id/keypad_5" > 
     </Button> 
     <Button android:text="6" 
      android:id="@+id/keypad_6" > 
     </Button> 
    </TableRow> 
    <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" > 
     <Button android:text="7" 
      android:id="@+id/keypad_7" > 
     </Button> 
     <Button android:text="8" 
      android:id="@+id/keypad_8" > 
     </Button> 
     <Button android:text="9" 
      android:id="@+id/keypad_9" > 
     </Button> 
    </TableRow> 
</LinearLayout> 

回答

0

你必須通過使用機器人來定義寬度和高度按鈕:layout_width =「30dip」機器人:layout_height =「40dip」 ..

更多詳細檢查this供您參考...