use*_*659 3 xml android intellij-idea
我无法将按钮放在彼此旁边.我研究了这个话题,但似乎没有任何帮助.
这是我的XML代码:链接
以下是它现在的显示方式: 我的屏幕
如果我尝试向下移动输入按钮,则清除按钮会上升,反之亦然.我可以将按钮从一侧移到另一侧,但从不与另一个按钮在同一条线上
现在你的两个按钮是垂直方向的元素LinearLayout.所有元素都显示在下一个元素之上,因此要使它们并排显示,您需要将它们简单地封装在水平LinearLayout容器中.
<LinearLayout android:layout-width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter"
android:id="@+id/enter"
android:layout_gravity="center"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear"
android:id="@+id/clear"
android:layout_gravity="bottom"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)