布局中的xml设置
设置其属性:android:background="#AA9E9E9E",其中前两位为透明度,后六位为颜色。
在代码中用的话就是用Java代码设置是这样设置的
View v = findViewById(R.id.content);//找到你要设透明背景的layout 的idv.getBackground().setAlpha(100);//0~255透明度值 ,0为完全
从FF开始表示完全不透明,到00表示完全透明。左边的是透明百分比,右边是透明的代号,如果你想设置颜色透明50%,就是
#809E9E9E
100% — FF99% — FC98% — FA97% — F796% — F595% — F294% — F093% — ED92% — EB91% — E890% — E689% — E388% — E087% — DE86% — DB85% — D984% — D683% — D482% — D181% — CF80% — CC79% — C978% — C777% — C476% — C275% — BF74% — BD73% — BA72% — B871% — B570% — B369% — B068% — AD67% — AB66% — A865% — A664% — A363% — A162% — 9E61% — 9C60% — 9959% — 9658% — 9457% — 9156% — 8F55% — 8C54% — 8A53% — 8752% — 8551% — 8250% — 8049% — 7D48% — 7A47% — 7846% — 7545% — 7344% — 7043% — 6E42% — 6B41% — 6940% — 6639% — 6338% — 6137% — 5E36% — 5C35% — 5934% — 5733% — 5432% — 5231% — 4F30% — 4D29% — 4A28% — 4727% — 4526% — 4225% — 4024% — 3D23% — 3B22% — 3821% — 3620% — 3319% — 3018% — 2E17% — 2B16% — 2915% — 2614% — 2413% — 2112% — 1F11% — 1C10% — 1A9% — 178% — 147% — 126% — 0F5% — 0D4% — 0A3% — 082% — 051% — 030% — 00
来源地址:https://blog.csdn.net/qq_36570506/article/details/131551336