Button BackgroundTint不适用于AppCompat v23

时间:2015-09-01 15:15:24

标签: java android button android-appcompat

我正在尝试使用AppCompat v23,以便使用BackgroundTint进行完整的按钮着色。

我已将compile 'com.android.support:appcompat-v7:23.0.+'添加到我的应用的build.gradle文件中。

我在AndroidManifest.xml中将我的应用主题设置为android:theme="@style/AppTheme"

在styles.xml中我有:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <!-- Customize your theme here. -->
    </style>
</resources>

我不是要覆盖任何东西,我只是想让基本主题发挥作用。

我在主要活动声明中使用public class LandingActivity extends AppCompatActivity

最后,在布局中,我在Button上有android:backgroundTint来设置colors.xml中的颜色。

在运行5.0的设备上,颜色完美运行。在4.0设备上,按钮上没有着色。这是默认的灰色。

我确信我错过了什么,但我不知道它是什么。 我是否需要采取其他步骤才能使AppCompat库发挥其魔力?

1 个答案:

答案 0 :(得分:12)

而不是 SELECT SUBSTRING_INDEX(data, '[fr]', 1) as new_data FROM table WHERE data LIKE '%[fr]%[/fr]%';

尝试使用

<Button android:backgroundTint="~" />