2013-03-23 106 views
-4

我正在構建一個計算器應用程序,我擁有所有按鈕的圖像。我還有一張我想用於計算器背景的圖像。我應該使用哪種佈局?

這裏是什麼,我有一個簡單的例子:

按鈕(所有單個圖像): enter image description here

背景(單幅影像): enter image description here

所需的外觀: enter image description here

我會用什麼佈局來放置一個圖像網格(按鈕)在罪惡之上gle圖像。 GridLayout通過FrameLayout?

回答

2

我會

<LinearLayout android:background="..." android:orientation="vertical"> 
    <LinearLayout android:orientation="horizontal"> 
     <Button ... /> 
     <Button ... /> 
     <Button ... /> 
    </LinearLayout><LinearLayout android:orientation="horizontal"> 
     <Button ... /> 
     <Button ... /> 
     <Button ... /> 
    </LinearLayout><LinearLayout android:orientation="horizontal"> 
     <Button ... /> 
     <Button ... /> 
     <Button ... /> 
    </LinearLayout><LinearLayout android:orientation="horizontal"> 
     <Button ... /> 
     <Button ... /> 
    </LinearLayout> 
</LinearLayout> 

去加入適當android:layout_weight值和你做。我不會使用GridLayout什麼的,因爲你根本沒有動態佈局。這是所有的靜態,將永遠不會改變...

1
<FrameLayout android:background="...."> 

...

+0

啊我看到你添加了背景屬性。謝謝! – 2013-03-23 11:44:21

+0

aha :)我編輯它!再次檢查@JanTacci – AVEbrahimi 2013-03-23 11:46:12

+0

gotcha謝謝! – 2013-03-23 11:47:09