android - 如何证明 Android Studio 中的内容 - XML
问题描述
我想知道是否有可能LinearLayout
像我通常为 web 所做的那样证明 Android Studio 中的内容是合理的。
网页 CSS
.space-around {
display: flex;
justify-content: space-around;
}
什么space-around
是在行中均匀分布,周围有相等的空间,使内容适合 div (链接)
我怎样才能在我的 Android Studio 中获得相同的效果LinearLayout
?
安卓
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:orientation="horizontal">
</LinearLayout>
解决方案
你可以这样:只要给 LinearLayout 的内部元素同样的权重:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
/>
</LinearLayout>
推荐阅读
- android - 查找文件和在路径中查找的快捷方式不再起作用
- asp.net-core - 如何在 asp.net 核心中为伊朗国家代码创建自定义验证属性?
- git - Git - 将开发和不同步的功能分支拉到新功能分支
- unity3d - Unity 中的 Touch Input 会记住最后一个位置
- bluetooth-lowenergy - 是否有任何 .c 源文件可用于将 TAI 时间转换为 UTC?
- google-search-console - 从未存在的页面的 Google 搜索控制台覆盖问题
- django - 如何使用cloud firestore在django中以表格的形式获取数据?
- android - 如何获取保存的卡详细信息razorpay android
- python - Kivysome 在我的电脑上工作,但不在我的安卓手机上
- firebase - 限制在 Firebase 中的访问