开发者

Not dim previous activity when new activity is started

When I start an activity B over activity A, A is dimme开发者_StackOverflowd. Is it possible to not dim activity A, when activity B is started?


This can be done by creating a new style in your res/values/styles.xml file with the attribute backgroundDimEnabled set to false:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.DoNotDimBackground" parent="android:Theme">
    <item name="android:backgroundDimEnabled">false</item>
  </style>
</resources>

In your manifest, you should simply apply the newly created style to your activity, which we will call, for example, Activity1

<activity android:name=".Activity1" android:theme="@style/Theme.DoNotDimBackground">


Here is approach for custom dialog

    Window win = getWindow();

    win.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    WindowManager.LayoutParams params = win.getAttributes();
    params.dimAmount = 0;
    win.setAttributes(params);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜