[英]android switch style is not applied on KitKat (4.4.2)
I applied some custom styles on items. 我在项目上应用了一些自定义样式。 When I am testing my application on different devices, I realized that all styles are applied properly except Switch style on Kitkat(4.4.2).
当我在不同设备上测试应用程序时,我意识到除了Kitkat(4.4.2)上的Switch样式外,所有样式都可以正确应用。 Is there a compatibility issue or should I use a different approach.
是否存在兼容性问题,或者我应该使用其他方法。 I spent some time searching a similar problem, however could not find.
我花了一些时间搜索类似的问题,但是找不到。 There is no problem with 4.2 and 4.3 devices but on 4.4 only switch style is not applied.
4.2和4.3设备没有问题,但在4.4上仅不应用开关样式。
This is my style: 这是我的风格:
<style name="switchStyle">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">0dp</item>
<item name="android:layout_marginBottom">0dp</item>
<item name="android:layout_marginLeft">20dp</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:thumb">@drawable/ab_bottom_solid_btom</item>
<item name="android:track">@drawable/switch_bg</item>
<item name="android:thumbTextPadding">30dp</item>
<item name="android:switchPadding">30dp</item>
</style>
and this is the switch 这是开关
<Switch
android:id="@+id/filter_switch"
style="@style/switchStyle"
android:layout_marginTop="20dp"
android:checked="true"
android:text=""
android:textOff="On"
android:textOn="Off" />
Is there a better way to customize switch? 有更好的自定义开关方法吗? Is this problem really related with os version?
这个问题真的和os版本有关吗?
Thank you. 谢谢。
I thought that it was about the os version but I realized that somehow I forgot to add the related background image for specific screen size. 我以为这是关于os版本的,但是我意识到以某种方式忘记为特定的屏幕尺寸添加相关的背景图片。 Since I forgot on only one screen size, style applied for all of other devices.
由于我只忘记一种屏幕尺寸,因此样式适用于所有其他设备。 But I wonder why it did'nt show any error or warnings.
但是我不知道为什么它没有显示任何错误或警告。 The related screen opened without no error or warnings.
相关屏幕打开,没有错误或警告。 It allocated the layout place but did not show the switch.
它分配了布局位置,但未显示开关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.