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子控件两端对齐的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 图像对比,Android
- 下一篇: html5移动端底部效果,spring