2013-03-23 124 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