gpt4 book ai didi

Android Switch 小部件 textOn 和 textOff 无法按预期工作

转载 作者:太空狗 更新时间:2023-10-29 16:42:52 29 4
gpt4 key购买 nike

我有一个 UI,我在其中添加了一个 Switch 小部件(在 API 14 中引入)。XML 看起来像这样:

<Switch
android:id="@+id/togglebutton"
android:layout_margin="10dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff="No"
android:textOn="Yes" />

您可以看到我指定了textOn 和textOff。所以我希望开关小部件上有这段文字。

然而,我得到的是: enter image description here enter image description here

在调试中检查了所有内容...仍然不明白为什么我的自定义文本没有出现!!

此外,自定义文本出现在 Galaxy S2 (Android 4.0.4) 上,但不会出现在 10"Galaxy Tab 上,同样在 Android 4.0.4 上!!

请帮忙。

最佳答案

我解决了...

问题是,对于 Galaxy 选项卡,默认主题是其他东西......例如它不是 Holo.Light!

一旦我强制主题(在我的应用程序中)从 Holo.Light 继承,我就得到了想要的结果......

关于Android Switch 小部件 textOn 和 textOff 无法按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14925743/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com