欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

android 两端对齐,LinearLayout子控件两端对齐

发布时间:2024/9/3 编程问答 63 豆豆
生活随笔 收集整理的这篇文章主要介绍了 android 两端对齐,LinearLayout子控件两端对齐 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

1、实例:

android:id="@+id/settingBtnContainer"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:layout_constraintLeft_toLeftOf="parent"

app:layout_constraintRight_toRightOf="parent"

app:layout_constraintTop_toTopOf="parent">

android:id="@+id/settingBtn"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="设置"

android:textSize="20sp" />

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="1" />

android:id="@+id/settingBtnIcn"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="@drawable/ic_baseline_keyboard_arrow_right_24" />

2、解决方案

在中间加入以下代码即可

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_weight="1" />

总结

以上是生活随笔为你收集整理的android 两端对齐,LinearLayout子控件两端对齐的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。