实现透明渐变的Activity
16lz
2021-01-26
如果光是透明全屏的Activity的话,直接继承内置theme即可
<activity
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"</activity>
然后这里需要渐变的效果,就需要自己写drawable文件了,在drawable文件夹下创建一个xml文件
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:angle="90" android:startColor="#5C000000" android:endColor="#F5000000"/></shape>
然后在values/styles.xml中自定义一个theme
<style name="Theme.ShapeBgStyle" parent="@android:style/Theme.Translucent.NoTitleBar"> <item name="android:windowBackground">@drawable/sharebg_shape</item></style>
然后在Manifest中将这个theme运用到activity上
<activity .... android:theme="@style/Theme.ShapeBgStyle"></activity>
更多相关文章
- Android笔记1——开发前奏1开发环境搭建和开发工具使用介绍
- android画图----ShapeDrawable和shader
- Android(安卓)创世纪 第二天
- Android之模拟网易新闻客户端
- android一些有用的方法总结(持续更新……)
- Android之APK文件签名——keytool和jarsigner
- 转载:重新签名,修改系统时间,android.uid.system
- android SDK更新不了的问题
- android 渐变