2023-09-20 Android CheckBox 让文字显示在选择框的左边

一、CheckBox 让文字在选择框的左边 ,在布局文件里面添加下面一行就可以。

复制代码
android:layoutDirection="rtl" 即可实现
android:paddingStart="10dp" 设置框文间的间距

二、使用的是left to right

复制代码
        <attr name="layoutDirection">
            <!-- Left-to-Right. -->
            <enum name="ltr" value="0" />
            <!-- Right-to-Left. -->
            <enum name="rtl" value="1" />
            <!-- Inherit from parent. -->
            <enum name="inherit" value="2" />
            <!-- Locale. -->
            <enum name="locale" value="3" />
        </attr>

三、测试效果

复制代码
            <CheckBox
                android:id="@+id/new_proto_checkbox"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginBottom="0dp"
                android:layoutDirection="rtl"
                android:paddingStart="0dp"
                android:text="new-proto"
                android:checked="false"
                android:visibility="visible"/>
相关推荐
Jomurphys19 小时前
Compose 调用 - 震动 LocalHapticFeedback
android·compose
非凡ghost19 小时前
小X分身APP(手机分身类工具)
android·windows·学习·智能手机·软件需求
erqi1 天前
Compose你入门吧
android
q***76561 天前
MySQL 中如何进行 SQL 调优
android·sql·mysql
zhanglinping6191 天前
MySQL——内置函数
android·数据库·mysql
m***78741 天前
mysql之字符串函数
android·数据库·mysql
w***71101 天前
MySQL 事务的操作和四大特性
android·数据库·mysql
松叶似针1 天前
Flutter三方库适配OpenHarmony【secure_application】— Android 端 FLAG_SECURE 实现分析
android·flutter
cjl_8520081 天前
[MySQL] MySQL复合查询(多表查询、子查询)
android·mysql·adb
stevenzqzq1 天前
Barrier的用法
android