android 实现半透明Activity
实现Activity半透明的方式有很多,这里只列举其中的两种。
1、通过Theme.Translucent(不推荐)
2、自定义style
一、只需要在Manifest中将需要设置半透明的Activity设置为以下之一即可
@android:style/Theme.Translucent
@android:style/Theme.Translucent.NoTitleBar
@android:style/Theme.Translucent.NoTitleBar.Fullscreen 但是当Activity继承自AppcompatActivity时,会出现
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
可以这样写
也可以这样写
同样在Manifest中设置Theme就可以了
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
