实现透明渐变的Activity
生活随笔
收集整理的這篇文章主要介紹了
实现透明渐变的Activity
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
如果光是透明全屏的Activity的話,直接繼承內置theme即可
<activityandroid: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>?
轉載于:https://www.cnblogs.com/cqcmdwym/p/3282456.html
總結
以上是生活随笔為你收集整理的实现透明渐变的Activity的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: hibernate annotation
- 下一篇: android学习---LinearLa