Nat*_*ist 6 java android button android-appcompat
我正在尝试使用AppCompat v23,以便使用BackgroundTint进行完整的Button着色.
我已经添加compile 'com.android.support:appcompat-v7:23.0.+'
到我的应用程序的build.gradle文件中.
我android:theme="@style/AppTheme"
在AndroidManifest.xml中设置了我的应用主题
在styles.xml我有:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
我不是要覆盖任何东西,我只是想让基本主题起作用.
我public class LandingActivity extends AppCompatActivity
在我的主要活动声明中使用.
最后,在布局中我有android:backgroundTint
一个Button来设置colors.xml中的颜色.
在运行5.0的设备上,颜色完美运行.在4.0设备上,按钮上没有着色.这是默认的灰色.
我确定我错过了什么,但我不知道它是什么. 我需要采取任何其他步骤才能让AppCompat库发挥其魔力吗?
小智 12
而不是
<Button android:backgroundTint="~" />
,
试着用
<android.support.v7.widget.AppCompatButton
xmlns:app="http://schemas.android.com/apk/res-auto"
app:backgroundTint="~"/>
归档时间: |
|
查看次数: |
4001 次 |
最近记录: |