WEB开发网
开发学院手机开发Android 开发 Android activity半透明的效果 阅读

Android activity半透明的效果

 2010-09-10 00:25:00 来源:WEB开发网   
核心提示:res/values/styles.xmlXml代码1.< resources>2. < style name="Transparent3.">4. < item name="android:windowBackground">@color/t

res/values/styles.xml

Xml代码

1.< resources>

2. < style name="Transparent

3.">

4. < item name="android:windowBackground">@color/transparent_background

5. < item name="android:windowNoTitle">true

6. < item name="android:windowIsTranslucent">true

7. < item name="android:windowAnimationStyle">@+android:style/Animation.Translucent

8.

9.< /resources>

< resources>

< style name="Transparent

">

< item name="android:windowBackground">@color/transparent_background

< item name="android:windowNoTitle">true

< item name="android:windowIsTranslucent">true

< item name="android:windowAnimationStyle">@+android:style/Animation.Translucent

< /style>

< /resources> res/values/color.xml

Xml代码

1.< ?xml version="1.0" encoding="utf-8"?>

2.< resources>

3. < color name="transparent_background">#50000000

4.< /resources>

< ?xml version="1.0" encoding="utf-8"?>

< resources>

< color name="transparent_background">#50000000

< /resources>

注意:color.xml的#5000000前两位是透明的效果参数从00--99(透明--不怎么透明),后6位是颜色的设置

YXvKDw'95

manifest.xml

Xml代码

1.< activity android:name=".TransparentActivity" android:theme="@style/Transparent">

2.< /activity>

< activity android:name=".TransparentActivity" android:theme="@style/Transparent">

< /activity>

java代码

Java代码

1.public void onCreate(Bundle savedInstanceState) {

2. super.onCreate(savedInstanceState);

3. setTheme(R.style.Transparent);

4. setContentView(R.layout.transparent);

5.}

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setTheme(R.style.Transparent);

setContentView(R.layout.transparent);

} 配置结束!

Tags:Android activity 透明

编辑录入:coldstar [复制链接] [打 印]
赞助商链接