今天遇到用pop来显示加载中,但是pop中的progressbar颜色太难看,用的又是默认样式,activity背景透明是灰色的,目的是想要达到真正的透明的效果。
1:直接在manifest里的activity里设置
android:theme="@android:style/Theme.Translucent"
这样也可以达到透明效果,但是对progressbar的圆圈没有什么影响,进度条还是较深的灰色
最后解决是:在values文件下建colors.xml里面设
<color name="transparent">#0000</color>
在values文件下的styles里面添加
<style name="Transparent">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
</style>
最后在manifest里的activity里设置
android:theme="@style/Transparent"
然后就能达到背景透明的效果。
如果有遇到类似的需要的可以用这方式来弄
大家一起可以交流下,共同进步。安卓群号:513210053