【问题标题】:Applying buttonStyle via theme wouldn't work, applying directly works perfectly通过主题应用buttonStyle不起作用,直接应用完美
【发布时间】:2013-08-01 14:37:36
【问题描述】:

我在将按钮样式应用到主题时遇到问题,但直接应用到按钮效果很好。知道这里有什么问题吗?

themes.xml

<style name="Theme.AppTheme" parent="@style/Theme.Sherlock.Light.DarkActionBar">
    <item name="android:buttonStyle">@style/ButtonAppTheme</item>
</style>

styles.xml

<style name="ButtonAppTheme" parent="@android:style/Widget.Button">
        <item name="android:background">@drawable/btn_default_holo_light</item>
        <item name="android:minHeight">48dip</item>
        <item name="android:minWidth">64dip</item>
        <item name="android:textColor">#000000</item>
</style>

AndroidManifest.xml

<Application
    android:name=".ThreesixtyusApp"
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppTheme" >

直接应用按钮样式有效:

  <Button
      android:id="@+id/like"
      android:layout_width="100dp"
      android:layout_height="wrap_content"
      style="@style/ButtonAppTheme"
      android:text="@string/like" />

【问题讨论】:

  • 可能是活动具有属性“主题”并且它覆盖了应用程序主题?
  • 这看起来是生成的。您是否忘记了 values-v11 或 values-v14 文件夹中的样式/主题?
  • @Krylez 谢谢!解决了问题,您应该将其发布为答案吗?

标签: android android-theme


【解决方案1】:

这看起来是生成的。您是否忘记了 values-v11 或 values-v14 文件夹中的样式/主题?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-17
    • 2020-02-04
    • 1970-01-01
    • 2015-07-29
    相关资源
    最近更新 更多