Android中自定义Activity和Dialog的位置大小背景和透明度等分类:android2011-07-1517:181490人阅读评论(2)收藏举报1
自定义Activity显示样式先在res/values下建colors
xml文件,写入:viewplainprint
#90005
viewplaincopytoclipboardprint
#9000这个值设定了整个界面的透明度,为了看得见效果,现在设为透明度为56%(9/16)左右
再在res/values/下建styles
xml,设置程序的风格viewplainprint
@color/transparent6
@+android:style/Animation
Translucent10
-->设置背景-->12
@color/transparent13
true15
@+android:style/Animation
Translucent17
viewplaincopytoclipboardprint
@color/transparenttrue@+android:style/Animation
Translucent-->设置背景-->@color/transparenttrue@+android:style/Animation
Translucent注:mce部分为发帖是自动生成的,实际不需要
最后一步,把这个styles
xml用在相应的Activity上
即在AndroidManifest
xml中的任意标签中添加android:theme="@style/transparent"如果想设置所有的activity都使用这个风格,可以把这句标签语句添加在中
最后运行程序,哈哈,是不是发现整个界面都被蒙上一层半透