Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

set alpha of only parent

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys,

I have a few textviews inside a linear layout, but when i set the alpha property in linear layout, even the child layouts appear half transparent, how can i set the property only for parent but not the child , either by xml or programatically ?

Regards,
Jeet
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The TextViews must have transparent backgrounds by default. Set their background to something specific.
 
Jeet Dholakia
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you interpreted that differently, i mean , my linear layout has an alpha property of 0.5 because its laid on top of an imageview,to render a better ux, but all the textviews inside linearlayout aren't supposed to have alpha, but that's the default android behavior i guess,so any workarounds? Setting alpha value of textview to 1 doesnt seem to work...
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you provide a sample layout that shows us the problem? That way I can run it and see what exactly you mean.
 
Jeet Dholakia
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sure ,

I'll give the the xml of what i mean , i think you'll get my question asap then




all i want is a 0.5 alpha of parent and 1 alpha of child...
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, if you set android:visibility="invisible" then the entire view group will be invisible, nothing to change that. Also, it looks like the android:alpha attribute is designed to set the alpha for a view group and all its children. So you shouldn't be using it. Instead, set the background color with the alpha you want. Example:


This looks like:

Note that the first text box, I did not set any specific background color, so it inherited the one from the scroll pane. But the second one I set a specific color, so it gets its own alpha channel, and is not hidden. Also note that I put an image in the FrameLayout, and set the ScrollView to have a gray background color so that you could see the alpha effect more clearly.
 
Jeet Dholakia
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks,

this is what i really wanted, especially i'd give a +1 for the wireframe had there been a button for that

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic