oct*_*ron 5 android android-layout android-styles
我一直在尝试更改 progressBar 的颜色,并且我注意到它使用了重音颜色(在我的情况下为蓝色),并且我一直试图在没有运气的情况下更改它。
我错过了什么吗?
这是在我的styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="searchViewStyle">@style/AppTheme.SearchView</item>
<item name="editTextColor">@android:color/white</item>
<item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item>
<item name="actionOverflowButtonStyle">@style/AppTheme.OverFlowItem</item>
<item name="colorPrimary">@color/ColorPrimary</item>
<item name="colorPrimaryDark">@color/ColorPrimaryDark</item>
<item name="colorAccent">@color/ColorPrimaryDark</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这是我在 layout.xml 中的元素
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/Widget.AppCompat.ProgressBar"
android:id="@+id/progressBar01"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:indeterminate="true"/>
Run Code Online (Sandbox Code Playgroud)
我的活动:
public class MainActivity extends android.support.v7.app.AppCompatActivity
Run Code Online (Sandbox Code Playgroud)
尝试这个
progressBar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.ColorPrimaryDark), Mode.SRC_IN);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2809 次 |
最近记录: |