<style name="custom" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item><!
<item name="android:windowIsFloating">true</item><!
<item name="android:windowIsTranslucent">true</item><!
<item name="android:windowNoTitle">true</item><!
<item name="android:windowBackground">@android:color/transparent</item><!
<item name="android:backgroundDimEnabled">false</item><!
<item name="android:backgroundDimAmount">0.6</item><!
<item name="android:windowContentOverlay">@null</item><!
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item><!
<item name="android:colorBackgroundCacheHint">@null</item><!
</style>
<activity android:name=".activity.ShareActivity"
android:theme="@style/custom">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
public class ShareActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_share);
WindowManager.LayoutParams windowLP1 = getWindow().getAttributes();
windowLP1.dimAmount = 0.5f;
getWindow().setAttributes(windowLP1);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
}
搞定。
参考http://www.cnblogs.com/a284628487/p/3175886.html