Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在api 14-15上显示为黑色的透明背景_Android - Fatal编程技术网

Android 在api 14-15上显示为黑色的透明背景

Android 在api 14-15上显示为黑色的透明背景,android,Android,我有一个进度条,我将其背景设置为透明。它适用于较新版本的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_p

我有一个进度条,我将其背景设置为透明。它适用于较新版本的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


有没有办法让它透明化

它可能与您正在使用的主题有关。确保在进度条下面显式设置视图的颜色

Holo Light和Holo Dark为根元素设置了不同的默认背景,因此覆盖它们可能会解决您的问题

您可以使用
\00FFFFFF
颜色而不是
@android:color/transparent


这对我来说很有用。

可能是应用程序主题是黑色的,因此尽管进度栏上有一个透明度,但容器元素的背景是黑色的。感谢您的帮助,stevebot我回答了答案。我将此答案标记为正确的,尽管我不确定它是否是答案,但很可能是正确的。最后我编辑了@drawable/speedometer\u progress\u栏,这是一个图层列表,底部的项目是@android:id/background。出于某种原因,它在android的api 17或更高版本中是透明的,但16或更低版本中的黑色可能与主题有关。我在那个项目上加了一个,这就成功了。谢谢你的帮助