Android .XML 常用文件的配置屬性

Activity 屬性設置

1、全屏設置

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
2、禁止屏幕旋轉,手動設置爲橫屏或豎屏

android:screenOrientation="portrait" 

(landscape是橫向,portrait是縱向)

3、安卓下的透明色

Button或者ImageButton的背景設爲透明或者半透明
半透明<Button android:background="#e0000000" ... /> 
透明<Button android:background="#00000000" ... />

 顏色和不透明度 (alpha) 值以十六進制表示法表示。任何一種顏色的值範圍都是 0 到 255(00 到 ff)。對於 alpha,00 表示完全透明,ff 表示完全不透明。表達式順序是“aabbggrr”,其中“aa=alpha”(00 到 ff);“bb=blue”(00 到 ff);“gg=green”(00 到 ff);“rr=red”(00 到 ff)。例如,如果您希望對某疊加層應用不透明度爲 50% 的藍色,則應指定以下值:7fff0000

RGB 
設置背景圖片透明度:
View v = findViewById(R.id.content);//找到你要設透明背景的layout 的id
v.getBackground().setAlpha(100);//0~255透明度值

設置顏色透明度:

ImageView.setBackgroundColor(Color.TRANSPARENT);


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章