在Eclipse环境下一步一步教您做透明的背景。
File->New->Other->Android XML File->Next
选择Value,输入文件名,点击“Finish”来创建配置文件。
创建colors.xml

1
2
3
4
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="transparent">#0000</color><!-- 0000是全透明,您也可以9000 -->
</resources>

创建styles.xml

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="translucent">
    <item name="android:windowBackground">@color/transparent</item>  
    <item name="android:windowIsTranslucent">true</item>  
    <item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
    </style>
</resources>


应用到您的窗口中。
创建完样式,但并没有立即应用到你的窗口界面中。你需要手动的指定,因此这样可以更灵活。
在AndroidManifest.xml文件中找到activity

1
2
 <activity android:name=".LoginForm"
              android:theme = "@style/translucent"> </activity>

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2012 客家缘分小筑 Suffusion theme by Sayontan Sinha