我有一个进度条,我将其背景设置为透明。它适用于较新版本的 android,但在 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。
任何想法如何使它透明?
最佳答案
这可能与您使用的主题有关。确保明确设置进度条下方 View 的颜色。
Holo Light 和 Holo Dark 为根元素设置了不同的默认背景,因此覆盖它们可能会解决您的问题。
关于android - 透明背景在 api 14-15 上显示为黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24875391/