欢迎访问 生活随笔!

生活随笔

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

编程问答

安卓平分位置layout_weight学习记录

发布时间:2025/3/20 编程问答 25 豆豆
生活随笔 收集整理的这篇文章主要介绍了 安卓平分位置layout_weight学习记录 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

weight (权重)  使用把layout_width写成0   weight 为平分剩余父容器位置

两个标签平分 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"android:layout_gravity=""android:gravity=""tools:context=".MainActivity"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:text="222222" /><TextViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:text="3333333" /></LinearLayout></LinearLayout>

  

转载于:https://www.cnblogs.com/xuexidememeda/p/10295459.html

总结

以上是生活随笔为你收集整理的安卓平分位置layout_weight学习记录的全部内容,希望文章能够帮你解决所遇到的问题。

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