天天看點

android 透明度

設定透明效果 大概有三種

1、用android系統的透明效果

Java代碼 

android:background="@android:color/transparent" 

例如 設定按鈕

<Button android:background="@android:color/transparent"  

  android:text="@+id/Button01"  

  android:id="@+id/Button01"  

  android:layout_width="wrap_content"  

  android:layout_height="wrap_content"  

  android:textColor="#ffffff" />  

2、用ARGB來控制

半透明<Button android:background="#e0000000" /> 

透明<Button android:background="#00000000" /> 

3、設定alpha

View v = findViewById(R.id.content);//找到你要設透明背景的layout 的id 

v.getBackground().setAlpha(100);//0~255透明度值 

下一篇: 換皮膚

繼續閱讀