简体   繁体   中英

Display a transparent Activity in Android?

How can I set (by code) an Activity to be transparent? I want the activity to become transparent when the user clicks a button. Is it possible?

You can use setTheme (android.R.style.Theme_Translucent)

But keep the api docs in mind:

Set the base theme for this context. Note that this should be called before any views are instantiated in the Context (for example before calling setContentView(View) or inflate(int, ViewGroup)).

Source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM