如何在同一行将两个button距离拉开,实现对称美观

BrownWong 2015-04-11 07:57:05
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="60dp"
android:orientation="horizontal"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:id="@+id/shake_result_button_next_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/shake_result_button_next" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<Button
android:id="@+id/shake_result_button_quit_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/shake_result_button_quit" />
</LinearLayout>
</LinearLayout>
这是我的代码,按理说应该就能达到我说的那个效果
结果:

这是为什么?
...全文
636 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
davl 2015-04-11
  • 打赏
  • 举报
回复
最外层 的布局试着加上weigh_sum = "2',里面的两个LinearLayout 的layout_width都设置成0dp
BrownWong 2015-04-11
  • 打赏
  • 举报
回复

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧