How do I create a transparent Activity on Android?

前端 未结 22 2195
忘掉有多难
忘掉有多难 2020-11-21 04:43

I want to create a transparent Activity on top of another activity.

How can I achieve this?

22条回答
  •  天涯浪人
    2020-11-21 05:40

    The easiest way that I have found is to set the activity's theme in the AndroidManifest to android:theme="@android:style/Theme.Holo.Dialog".

    Then in the activity's onCreate method, call getWindow().setBackgroundDrawable(new ColorDrawable(0));.

提交回复
热议问题