簡體   English   中英

無法更改SwitchCompat小部件的文本大小

[英]can't change the textsize of the thumb of SwitchCompat widget

我很難改變開關緊湊型拇指的文字大小。

這是我的布局:

<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”上做什么,開關總是如下所示:

在此輸入圖像描述

理想情況下,我希望它看起來像這樣:

在此輸入圖像描述

任何人都願意分享他們的drawables我可以嘗試匹配上面的圖像?

我正在調查這些線程但沒有正確匹配。 它讓它看起來更糟。

如何更改Switch Widget的大小

謝謝!

其實你需要使用

app:switchTextAppearance="@style/MyStyle"

結果:

在此輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM