Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
nimithingu
Posts: 37
Registered: ‎09-04-2012
My Device: Blackberry 10 Dev Alpha

Creating List Item in QML need help with opacity

[ Edited ]

HI I am trying to acheive some thing like the image below

 

sshot.png

 

But the text is also getting opaque if i change the opacity of the container in which the label is present please see the qml code below please help..

 

 

Container {
            maxHeight: 300
            maxWidth: 300
            topPadding: 10
            leftPadding: 10
            layout: DockLayout {
            }

            // The ImageView that shows the loaded image after loading has finished without error
            ImageView {
                preferredWidth: parent.maxWidth
                preferredHeight: parent.maxHeight
                imageSource: "asset:///images/face.png"
                verticalAlignment: VerticalAlignment.Fill
                horizontalAlignment: HorizontalAlignment.Fill
            }
            Container {
                preferredWidth: 300
                horizontalAlignment: HorizontalAlignment.Center
                verticalAlignment: VerticalAlignment.Bottom
                background: Color.Gray
                opacity: 0.5
                Label {
                    id: headlbl
                    text: "test sdjf sdjkhfb sdkjfh sdjkfh sdkfhj sds sdfs sdf"
                    multiline: true
                    textStyle.color: Color.White
                    textStyle.fontSize: FontSize.XSmall
                    textStyle.fontStyle: FontStyle.Normal
                    textStyle.fontWeight: FontWeight.Bold
                    opacity: 1.0
                }
            }
        }

 How to make the container opacity less by keeping the label's opacity as 1.0

 

 

 

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Creating List Item in QML need help with opacity

Put the label into another container with the same width and alignment, but without background color.

Andrey Fidrya, @zmeyc on twitter
Developer
nimithingu
Posts: 37
Registered: ‎09-04-2012
My Device: Blackberry 10 Dev Alpha

Re: Creating List Item in QML need help with opacity

Nope it did not work I tried this earlier also..
Contributor
xtravanta
Posts: 46
Registered: ‎03-25-2011
My Device: Blackberry Z10

Re: Creating List Item in QML need help with opacity

I'm not sure what you are trying to do.. but do you want show a placeholder image or something ?
Developer
nimithingu
Posts: 37
Registered: ‎09-04-2012
My Device: Blackberry 10 Dev Alpha

Re: Creating List Item in QML need help with opacity

[ Edited ]

If u will check the image in the above post is what I want to acheive .

Basically I want to do is change the opacity of the background of a container but not its childrens like in this case the label I refrain from using a transperant image as the text is dynamic and the height may increase or decrease so.

 

Hope I was clear enough..