我正在使用AppCompat和設計庫爲Android 4.0+開發應用程序。在Android 5.0上一切都很好。但在Android 4.0上,我看到了舊的進度條風格。如何在Android 4.0中使用Android 5+的ProgressBar
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 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>
你可能沒有設置你的'Theme'權,對於版本低於5.0 – Emmanuel
是那個進度條還是找吧? – Androider
這是一個seekbar。但在這種情況下,沒關係 –