【问题标题】:How can I change the border thickness of an Android checkbox?如何更改 Android 复选框的边框粗细?
【发布时间】:2016-10-29 18:55:25
【问题描述】:

android 复选框的默认尺寸对于我的目的来说太小了,所以我改变了它们的整体尺寸,但是随着它们的新尺寸,它们的边框现在非常厚。

我可以通过什么方式更改厚度?我非常喜欢复选框的默认行为,所以我唯一想改变的是边框的厚度。

用于使复选框变大的代码:

<CheckBox
android:id="@+id/item_switch"
android:layout_width="160dp"    
android:layout_height="160dp"
android:button="@null"
android:background="?android:attr/listChoiceIndicatorMultiple"/>

来自这个SO answer。

【问题讨论】:

  • 你能提供你的复选框xml代码吗?
  • 我更新了 OP。
  • 使用android:layout_width="wrap_content"和android:layout_height="wrap_content"

标签: android checkbox styles thickness


【解决方案1】:

所以你的代码应该看起来

<CheckBox
android:id="@+id/item_switch"
android:layout_width="wrap_content"   
android:layout_height="wrap_content"
android:button="@null"
android:background="?android:attr/listChoiceIndicatorMultiple"/>

【讨论】:

  • 对,但现在按钮具有默认大小,这让我回到了第一个正方形。我需要按钮更大(宽度和高度为 160dp)并减少边框厚度。
  • 我的意思是我想设置按钮的样式,使其更大,并且在更大时没有那么厚的边框。
  • 我是否正确地得出结论,我必须为复选框制作自己的自定义图像才能获得我想要的外观?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-07-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-28
  • 2020-02-08
相关资源
最近更新 更多