2013-02-23 26 views
5

Tôi xây dựng một dự án Android với targetSdkVersion = "15" & minSdkVersion = "8", sau đó thêm thanh tiến trình nằm ngang trong hoạt động, nhưng nó không phải kiểu holo khi tôi chạy dự án này với đậu thạch android.Làm thế nào để thêm Holo Style Horizontal ProgressBar khi minSdkVersion nhỏ hơn 11?

Tôi có thể làm gì? thế nào để chỉnh sửa style.xml v14?

bố trí:

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

giá trị & giá trị-v14 style.xml

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

Thanks a lot.

+1

Sử dụng https://github.com/ChristopheVersieux/HoloEverywhere – PravinCG

Trả lời

2

Sử dụng ?android:attr/progressBarStyleHorizontal thay vì @android:style/Widget.ProgressBar.Horizontal.

Khi tôi hiểu điều này, ?android:attr/progressBarStyleHorizontal là kiểu thanh tiến trình theo chủ đề hiện tại trong khi @android:style/Widget.ProgressBar.Horizontal chỉ là kiểu thanh tiến trình android đơn giản.

Mã nên trông giống như:

<ProgressBar 
    android:id="@+id/countdown_progressbar" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    style="?android:attr/progressBarStyleHorizontal" 
    android:max="30" /> 
+0

Vui lòng thêm rõ như thế nào và tại sao điều này sẽ giúp. – Zane

Các vấn đề liên quan