本文介绍了如何进行半透明活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hellow,我正在尝试创建半透明的Activity并在styles.xml中定义代码,但是我无法使我的Activity变为半透明.我怎样才能使它变得半透明的任何人都可以帮助?我的styles.xml代码发布在下面.
Hellow, I'm trying to create the translucent Activity and define the code in styles.xml but i'm unable to make my activity Translucent. how can i make it translucent can anybody help? my code of styles.xml is posted below.
<resources>
<!-- Base application theme. -->
<style name="TaxiTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="TaxiTheme.NoActionBar.FullScreen" parent="TaxiTheme">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="TaxiTheme.NoActionBar" parent="TaxiTheme">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
<color name="transparent_color">#129049</color>
<style name="Theme.Transparent" parent="TaxiTheme">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowBackground">@color/transparent_color</item>
<item name="android:windowIsTranslucent">true</item>
</style>
推荐答案
将此主题应用于所需的活动
Apply this theme to the required Activity
<style name="Theme.TransparentInfo" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/semiTransparentBlack</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
@ color/semiTransparentBlack的
值为#00000000
value for @color/semiTransparentBlack is #00000000
这篇关于如何进行半透明活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!