当前位置: 移动技术网 > 科技>操作系统>windows > Android AppCompatActivity 透明activity实现

Android AppCompatActivity 透明activity实现

2020年09月01日  | 移动技术网科技  | 我要评论
1.继承AppCompatActivity 在 onCreate 中添加如下代码int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ;getWindow().getDecorView().setSystemUiVisibility(uiOptions);getWindow().setStatusBarColor(Color.TRANSPARENT);2设置activity 主题在style.xml 文件中添加<st.

1.继承

AppCompatActivity 在 onCreate 中添加如下代码
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
getWindow().setStatusBarColor(Color.TRANSPARENT);

2设置activity 主题
在style.xml 文件中添加
 

<style name="translucentTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@color/transparent</item>
    <item name="android:windowIsTranslucent">true</item>
</style>
3.
<activity android:name=""
    android:theme="@style/translucentTheme"
    android:windowSoftInputMode="adjustResize"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:hardwareAccelerated="false"
    />

本文地址:https://blog.csdn.net/mylisty/article/details/108572838

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网