5

我用 targetSdkVersion="15" & minSdkVersion="8" 构建了一个 android 项目,然后在活动中添加了一个水平进度条,但是当我用 android jelly bean 运行这个项目时它不是全息样式。

我能做些什么?编辑值-v14 style.xml?

布局:

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

<ProgressBar
    android:id="@+id/countdown_progressbar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    style="@android:style/Widget.ProgressBar.Horizontal"
    android:max="30" />

价值观和价值观-v14 style.xml

<style name="AppTheme" parent="Theme.Sherlock.Light" />

非常感谢。

4

2 回答 2

2

您将需要获取进度条的资源。您可以使用 styles.xml 文件从 http://android-holo-colors.com/获取它们或使用 HoloEverywhere 库:https ://github.com/Prototik/HoloEverywhere

于 2014-02-22T18:20:10.307 回答
2

使用?android:attr/progressBarStyleHorizontal而不是@android:style/Widget.ProgressBar.Horizontal.

据我了解,?android:attr/progressBarStyleHorizontal是当前主题样式的进度条样式,而@android:style/Widget.ProgressBar.Horizontal只是普通的 android 进度条样式。

代码应如下所示:

<ProgressBar
    android:id="@+id/countdown_progressbar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    style="?android:attr/progressBarStyleHorizontal"
    android:max="30" />
于 2014-10-01T14:52:59.633 回答