【问题标题】:Set progress bar color in actionbar sherlock在 actionbar sherlock 中设置进度条颜色
【发布时间】:2012-10-10 09:03:35
【问题描述】:

我们如何在ABS中设置进度条的颜色。默认情况下,它是蓝色的,与深色主题完美搭配。但是当我使用浅色主题时,它几乎不可见。

我应该覆盖 android:progressBarStyle 样式中的哪个项目以更改颜色。我想实现与此链接Styling the progressbar in ActionbarSherlock 中描述的完全相同。

【问题讨论】:

    标签: android actionbarsherlock android-progressbar


    【解决方案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>
    

    可绘制的

    <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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多