我正在使用horizontal view
基本Android
计算器,我有一个名为LinearLayout
的{{1}},我试图放在{{1}之上},包含数字linearLayout2
。问题在于,当我尝试在linearLayout3
之上移动1, 2, 3, +, -, and (
时,它立即消失到顶部,高度为0。
以下是linearLayout2
代码:
linearLayout3
答案 0 :(得分:2)
如果您想开发计算器,请尝试使用lblTotalCost
代替Gridlayout
。
答案 1 :(得分:1)
您的Layout2
正在使用wrap_content
作为身高
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout2"
android:orientation="horizontal"
android:weightSum="1"
android:layout_above="@+id/linearLayout3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
但该组中没有内容(没有子视图),所以这是正确的行为,因为不需要使组高更大。
此外,如果您想在Layout3上堆叠Layout2,您可以考虑将它们整合在FrameLayout
(或其他RelativeLayout
)中