Android CheckedTextView - 动态设置checkMark

发布于 2024-08-17 03:55:48 字数 323 浏览 3 评论 0原文

给定 CheckedTextView 的 checkMark 的 XML 属性:

android:checkMark="?android:attr/listChoiceIndicatorMultiple"

如何动态设置 checkMark 属性(即从代码)? Android 有这方面的文档吗?

使用: Android 1.5

注意: 我正在构建一个常规 jar 库,它无法访问 android XML 资源文件或可绘制文件,因此所有内容都必须以编程方式创建。

Given this XML property of the CheckedTextView's checkMark:

android:checkMark="?android:attr/listChoiceIndicatorMultiple"

How can you set the checkMark property dynamically (i.e. from code)?
Does Android have any documentation on this?

Using: Android 1.5

Note:
I am building a regular jar library that does not have any access to android XML resource files or drawables so everything has to be created programatically.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

棒棒糖 2024-08-24 03:55:48

CheckedTextView 的 API 文档来看,听起来像两个 setCheckMarkDrawable 方法可以完成这项工作吗?

您只需传入一个 StateListDrawable 即可。

From the API doc of CheckedTextView, it sounds like the two setCheckMarkDrawable methods would do the job?

You just need to pass in a StateListDrawable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文