Android 想要创建一个应用程序,其中在中间垂直和水平显示3个按钮,但当我尝试只显示第3个按钮时,
我想创建一个显示3个按钮的应用程序,但当我运行代码时,它会显示第三个按钮,而其他按钮没有此代码--> 这是我的截图Android 想要创建一个应用程序,其中在中间垂直和水平显示3个按钮,但当我尝试只显示第3个按钮时,,android,Android,我想创建一个显示3个按钮的应用程序,但当我运行代码时,它会显示第三个按钮,而其他按钮没有此代码--> 这是我的截图 ``` [在此处输入图像描述][2] [1]: https://i.stack.imgur.com/Ih3mK.png [2]: https://i.stack.imgur.com/vLjRr.png![在此处输入图像描述](https://i.stack.imgur.com/gM59v.png)![在此处输入图像描述](https://i.stack.imgur.com/TRL
```
[在此处输入图像描述][2]
[1]: https://i.stack.imgur.com/Ih3mK.png
[2]: https://i.stack.imgur.com/vLjRr.png![在此处输入图像描述](https://i.stack.imgur.com/gM59v.png)![在此处输入图像描述](https://i.stack.imgur.com/TRLj3.png)
尝试下面的代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="button1" />
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="button2"
/>
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="button3"
/>
</LinearLayout>
以下是我正在分享的代码,它显示了3个按钮的水平和垂直线条布局
添加你想要的布局的ss。有人能帮我读一下我的评论吗!什么是ss我不知道?给我看看你的代码谢谢pratikvekariya@TechGamerAnimator如果我的答案对你有用,那么你能纠正它吗?如果你发现答案正确,请将它标记为正确!提前谢谢
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="button1" />
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="button2"
/>
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="button3"
/>
</LinearLayout>