发布于 2016-02-27 08:48:01 | 513 次阅读 | 评论: 0 | 来源: 网友投递
Android移动端操作系统
Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。
方法一:
res/values文件夹下建立styles.xml:
<?xml version=“1.0″ encoding=“utf-8″?>
<style name="translucent">
<item name="android:windowBackground">@color/translucent_background</item>
<item name="android:windowIsTranslucent">true</item>
</style>
<?xml version=“1.0″ encoding=“UTF-8″?>
<RESOURCES>
<color name="translucent_background">#60000000</color>
</RESOURCES>
Window window=getWindow();
WindowManager.LayoutParams wl = window.getAttributes();
wl.flags=WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
wl.alpha=0.6f; 这句就是设置窗口里崆件的透明度的.0.0全透明.1.0不透明.
window.setAttributes(wl);
<resources>
<style name="Transparent
">
<item name="android:windowBackground">@color/transparent_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@+android:style/Animation.Translucent</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="transparent_background">#50000000</color>
</resources>
<activity android:name=".TransparentActivity" android:theme="@style/Transparent">
</activity>
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.Transparent);
setContentView(R.layout.transparent);
}