在操作栏sherlock中设置进度条颜色

时间:2012-10-10 09:03:36

标签: android actionbarsherlock android-progressbar

如何在ABS中设置进度条的颜色。默认情况下,它呈现蓝色,看起来很完美,带有黑色主题。但是当我使用浅色主题时,几乎看不到它。

android中的哪个项目:progressBarStyle我应该覆盖以改变颜色。我希望在此链接上Styling the progressbar in ActionbarSherlock完全相同。

1 个答案:

答案 0 :(得分:1)

回答我自己的问题。 我没有使用操作栏进度,而是在布局文件中添加了一个progressbar元素。然后将xml文件设置为progressdrawableprogress bar,并设置所需的颜色。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ProgressBar android:id="@+id/progress"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="4dp"
        android:max="100"
        android:progress="0"
        android:secondaryProgress="0" 
        android:visibility="gone"/>

    <WebView 
        android:id="@+id/webview"
        android:layout_width="fill_parent"      
        android:layout_height="fill_parent"/>

</LinearLayout>

progressdrawable

<item android:id="@android:id/progress">
    <clip>
        <shape>
            <gradient
                android:angle="270"
                android:centerColor="@color/progresscolor"
                android:centerY="0.75"
                android:endColor="@color/progresscolor"
                android:startColor="@color/progresscolor" />
        </shape>
    </clip>
</item>