Android 实现透明效果的 Activity

时间:2014-09-29 15:39:32   收藏:0   阅读:354

Android系统提供了将Activity设置为透明的主题:@android:style/Theme.Translucent

 

该属性同时支持隐藏TitleBar和全屏显示。只需要在AndroidManifest.xml配置文件中为对应的Activity增加该属性即可。


<activity
            android:name=".activities.MyActivity"

            android:theme="@android:style/Theme.Translucent.NoTitleBar" />


如果希望实现半透明的效果,首先将Activity设置为透明,然后将Activity的布局文件的全局背景设置为半透的颜色值。


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:stepset="http://schemas.android.com/apk/res/******"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#70000000">
    

</RelativeLayout>


原文:http://blog.csdn.net/vvcumt/article/details/39670321

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!