android activity非全屏、透明

drawable中创建platformbackground.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<padding android:left="@dimen/rect_activity_left" android:top="@dimen/rect_activity_top"
android:right="@dimen/rect_activity_right" android:bottom="@dimen/rect_activity_bottom" />
<corners android:radius="8dp" />
<solid android:color="#50ffffff" />

</shape>

<solid android:color="#50ffffff" />删除则透明

styles.xml中引用

<style name="notfullscreen">
<item name="android:windowBackground">@drawable/platformbackground</item>
<item name="android:windowNoTitle">true</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
</style>


androidmainfest.xml中引用:android:theme="@style/notfullscreen"

application中用所有activity均有效,

activity中用只针对该activity