简体   繁体   English

将相对布局的透明前景重叠,以使文本视图在相对布局内部变为灰色透明

[英]Overlap a transparent foreground of a Relative layout to make text views color gray transparent inside Relative layout

I tried following: 我尝试了以下操作:

Created a frame layout containing that relative layout and made foreground /background color transparent. 创建包含该相对布局的框架布局,并使前景色/背景色透明。 But I got transparent layout above my Relative Layout But Cannot see the textviews of Relatives layout which was initially of dark black color. 但是我在相对布局上方获得了透明布局,但是看不到相对布局的文本视图,该视图最初是深黑色的。

Also tried dynamically by creating a drawable with transparent color setting it to foreground of frame layout containing that relative layout. 还通过创建具有透明颜色的drawable进行动态尝试,将其设置为包含该相对布局的框架布局的前景。 getting still the same result. 得到仍然相同的结果。

Any help would be greatly appreciated ? 任何帮助将不胜感激 ?

I solved it by just setting correct Alpha. 我通过设置正确的Alpha解决了它。

view.setAlpha(x);

I had initially set up the value of x as 90 which has no effect on the view. 我最初将x的值设置为90,这对视图没有影响。 After setting up the value of x as 0.9f (float/double), it worked. 将x的值设置为0.9f(浮点/双精度)后,它可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM