android - 如何在 flexbox 中居中“TextView”?
问题描述
我尝试在 FlexboxLayout 中将文本居中。我使用这个库 com.google.android:flexbox:0.2.5。我在列中有几个文本。我尝试了很多方法将它们放在该列的中间但没有成功。
<com.google.android.flexbox.FlexboxLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
style="?metaButtonBarStyle"
android:layout_width="77dp"
android:layout_height="match_parent"
android:background="@drawable/bg_pattern_dark_bitmap"
android:orientation="vertical"
android:alpha="1"
app:flexWrap="wrap"
app:justifyContent="space_between"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="lol"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="lol"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="lol"
/>
</com.google.android.flexbox.FlexboxLayout>
感谢您的任何帮助
解决方案
使用app:justifyContent="space_evenly"
代替space_between
推荐阅读
- plugins - 将 tt_content 的 TCA 更改为子类型?
- ssl - 套接字 sslerror 握手失败 Python 2.4.3
- php - MAMP 4.2 + CodeIgnter 4.1:无法在 Windows 10 环境下加载 PHP 7.4.1 中的 intl 扩展
- assembly - How to split a 32-bit integer to two 16-bit half-words
- r - 在条件发生变化的情况下按条件创建序列
- sql - 在 SQL 和 SSRS 中填充一个月中的所有日期
- python - 在 conn.request() 中编码变量时如何克服“字段必须包含整数”?
- javascript - 是什么导致在 IntersectionObserver 上执行观察失败?
- html - 使边框图像变圆
- microsoft-graph-api - Office.js 和 Graph 之间的邮箱项目 ID 不匹配