[英]Button BackgroundTint not working with AppCompat v23
我正在尝试使用AppCompat v23,以便使用BackgroundTint进行完整的Button着色。
我已将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
在我的主要活动声明中public class LandingActivity extends AppCompatActivity
。
最后,在布局中我有一个Button android:backgroundTint
在Button上设置colors.xml中的颜色。
在运行5.0的设备上,颜色完美运行。 在4.0设备上,按钮上没有着色。 这是默认的灰色。
我确定我错过了什么,但我不知道它是什么。 我需要采取任何其他步骤才能让AppCompat库发挥其魔力吗?
而不是<Button android:backgroundTint="~" />
,
试着用
<android.support.v7.widget.AppCompatButton xmlns:app="http://schemas.android.com/apk/res-auto" app:backgroundTint="~"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.