无法更改SwitchCompat小部件的拇指的文本大小 [英] can't change the textsize of the thumb of SwitchCompat widget

查看:361
本文介绍了无法更改SwitchCompat小部件的拇指的文本大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难更改紧凑型拇指开关的文本大小.

I am having a hard time to change the text size of a switch compact thumb.

这是我的布局:

<android.support.v7.widget.SwitchCompat
    android:id="@+id/switch_compat2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="20dp"
    android:checked="true"
    android:switchTextAppearance="@style/MyStyle"
    android:text="SwitchCompat (SDK v7+)"
    app:showText="true" />

和样式:

<style name="MyStyle">
    <item name="android:textColor">#229922</item>
    <item name="android:textSize">10sp</item>
</style>

但是,无论我在"MyStyle"上做什么,该开关始终看起来像这样:

yet, no matter what I do on "MyStyle", the switch always look like this:

理想情况下,我希望它看起来像这样:

Ideally I want have it look like this:

任何人都愿意分享他们的绘画内容,以便我可以尝试匹配上面的图像吗?

Anyone would be willing to share their drawables to I can try to match the image above?

我正在研究这些线程,但匹配不正确.这使它看起来更糟.

I am looking into these threads but not matching properly. It is making it look worse.

如何更改Switch小部件的大小

谢谢!

推荐答案

实际上您需要使用

app:switchTextAppearance="@style/MyStyle"

结果:

这篇关于无法更改SwitchCompat小部件的拇指的文本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆