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