我有一個進度條,我將其背景設置爲透明。它適用於較新版本的Android,但在14和15上顯示爲黑色。這是我的佈局:在api上顯示爲黑色的透明背景14-15
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".RaceActivity" >
<ProgressBar
android:id="@+id/speedometer_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/speedometer_title"
android:layout_below="@id/current_distance_title"
android:padding="8dp"
android:background="@android:color/transparent"
android:progressDrawable="@drawable/speedometer_progress_bar"
style="@android:style/Widget.ProgressBar.Horizontal"/>
</RelativeLayout>
我的應用程序的主題是android:Theme.Holo.Light.DarkActionBar。
任何想法如何使它透明?
這可能是應用程序的主題是黑色的,所以雖然你有進度條上的透明度,容器元素有一個黑色的背景。 – stevebot
謝謝你的幫助stevebot我回答了答案。 – yaronbic