无法从库项目覆盖项目中的ProgressBar样式

时间:2016-07-29 06:04:14

标签: android android-styles android-progressbar

我已经在lib中编写了进度条的样式,现在想要在主项目中更改进度条的颜色以进行自定义。

lib style

 <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@drawable/ic_home_selected" android:state_selected="true" />
        <item android:drawable="@drawable/ic_home_deselected" />
    </selector>

主要风格

tabDashboardLayout = (TabLayout) findViewById(R.id.tabDashboardLayout);        
        //Adding the tabs using addTab() method
        View tabView = getTabView(R.drawable.tab_home_selector);;
        tabDashboardLayout.addTab(tabDashboardLayout.newTab().setCustomView(tabView));

v21的风格

<style name="progressBar" parent="@style/Base.Widget.AppCompat.ProgressBar">
    <item name="android:indeterminateDrawable">@drawable/progress</item>
</style>

progress.xml

 <style name="progressBarOC" parent="@style/progressBar">
    <item name="android:indeterminateDrawable">@drawable/progress</item>
</style>

0 个答案:

没有答案