[英]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.