android - 有没有办法将复选框图标及其文本移动到屏幕中心
问题描述
<CheckBox
android:id="@+id/cb_whatsapp_consent"
android:layout_width="wrap_content"
android:layout_height="@dimen/button_height"
android:layout_marginTop="@dimen/size_16dp"
android:background="@color/white"
android:checked="true"
android:text="@string/get_updates_and_reminders_on"
android:textColor="@color/grey_text"
android:textSize="@dimen/text_size_small"
android:visibility="visible"
tools:visibility="visible"
android:layout_gravity="bottom|center"
android:gravity="center"
android:layout_marginBottom="80dp"/>** I have tried by adding layout_width as match_parent but in that case only the text moves to centre and the checkbox still remains to left(Screenshot added with name as [Screen when layout_width is given as match_parent and scrolled][3]match_parent). I have alsotried by adding the padding, But the padding gets applied only to text. **
解决方案
在约束布局中使用: starttostartof="parent" endtoendof="parent"
推荐阅读
- android - Jetpack Security 与两个主密钥的使用
- git - Git 和 Overleaf 之间的同步
- javascript - 如何在ckeditor5中添加文本
- javascript - 不使用 ID 将文本复制到剪贴板
- laravel - 记录工作派遣的来源
- haskell - Haskell 教堂数字无法打印 | 需要一个类型,但 T 有类型 `f`
- kotlin - 在 Flow 上编写扩展功能
。抓住 - c# - 使用 KeyVault 机密覆盖 Azure 应用服务中和本地的 appsettings
- ssh - 在排除某些文件的情况下,从第三台服务器在两台远程服务器之间传输文件
- python - How do I use plt.savefig() within docker container to save to my home directory