【问题标题】:Custom button style shown in GUI preview, but not in actual appGUI 预览中显示的自定义按钮样式,但实际应用中没有
【发布时间】:2015-08-07 12:18:32
【问题描述】:

styles.xml:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="android:buttonStyle">@style/button_style</item>
    </style>

    <style name="button_style" parent="@android:style/Widget.Button">
        <item name="android:background">@drawable/simple_button</item>

    </style>
</resources>

我已经验证 simple_button 可以工作 - 如果我手动将它分配给按钮的背景,它会显示在应用程序中。

【问题讨论】:

    标签: android button styles drawable


    【解决方案1】:

    您只有一个styles.xml 文件吗?检查这个。 一般有多个styles.xml 文件。 (ex> values/styles.xml, values-v21/styles.xml, etc...) 并检查您的设备信息。

    【讨论】:

      【解决方案2】:

      尝试使用

      <item name="buttonStyle">@style/button_style</item>
      

      代替:

      <item name="android:buttonStyle">@style/button_style</item>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-10-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-01
        • 1970-01-01
        相关资源
        最近更新 更多