我正在使用 AppCompat 和设计库开发适用于 Android 4.0+ 的应用程序。在 Android 5.0 上一切看起来都很好。但是在 Android 4.0 上,我看到了旧的进度条样式。
XML 布局:
<FrameLayout
android:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<SeekBar
android:id="@+id/play_seek_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
样式:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>
<style name="ActionBarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorControlActivated">#fff</item>
</style>
</resources>
Activity 声明:
<activity android:name=".ui.PlayListsActivity"
android:launchMode= "singleInstance"
android:screenOrientation="portrait"
android:theme="@style/AppBaseTheme"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
最佳答案
v7 appcompat 库的版本 23.1.0 添加了 Material 设计 Seekbar
,如您在 changelog 中所见.
您可能正在使用旧版本的 v7 appcompat 库。更新到最新版本后,SeekBar
将像其他小部件一样自动采用 Material Design 样式作为主题。
改变你的应用build.gradle
的依赖:
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
...
}
这些是在 Android 4.4 上获得的结果。
关于android - 如何在 Android 4.0 中使用 Android 5+ 的 ProgressBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33594973/