【问题标题】:Android ToggleButton: resize text for fit into itAndroid ToggleButton:调整文本大小以适应它
【发布时间】:2015-09-18 20:30:22
【问题描述】:

在我的 Android 应用中,我有几个 ToggleButton,带有前缀大小和文本大小:

<ToggleButton xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="73dp"
    android:layout_height="25dp"
    android:background="@drawable/filtro_toggle_bg"
    android:textColor="@color/textcolor"
    android:textSize="@dimen/sp14" > 

现在,如果文本不适合切换,我将动态分配 textSize 来切换。 例如,像“choccolate”这样的长词不适合切换,而是显示为“choccol...”。

【问题讨论】:

标签: android text-size android-togglebutton


【解决方案1】:

您可以使用android:ems 属性(mutch 'M' 应该如何适应)或将android:layout_width 设置为wrap_content 或两者兼而有之:)

【讨论】:

    猜你喜欢
    • 2018-09-04
    • 1970-01-01
    • 2016-11-24
    • 1970-01-01
    • 2016-07-31
    • 2020-04-14
    • 2015-12-10
    • 2011-12-24
    • 1970-01-01
    相关资源
    最近更新 更多