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

Java Development

Reply
Regular Contributor
tnathos
Posts: 92
Registered: ‎07-19-2010
My Device: 8520
Accepted Solution

Background linear gradient to Label?

Hi..

 

Its posible put to a label a background gradient? i try but doesnt works...

 

 

Background bgNaranja = BackgroundFactory.createLinearGradientBackground(0xc14d02, 0xc14d02, 0xeb870e, 0xeb870e);

 

Background bgNaranja = BackgroundFactory.createLinearGradientBackground(0xc14d02, 0xc14d02, 0xeb870e, 0xeb870e);

 

 

LabelField lblreiniciar = new LabelField("Mi cuenta", LabelField.USE_ALL_WIDTH){

public void paint(Graphics graphics)

{

graphics.setColor(Color.RED);

graphics.clear();

super.paint(graphics);

}

};

 

lblreiniciar.setFont(textos);

lblreiniciar.setBackground(bgNaranja);

 

Please use plain text.
Regular Contributor
tnathos
Posts: 92
Registered: ‎07-19-2010
My Device: 8520

Re: Background linear gradient to Label?

any?

Please use plain text.
New Developer
breato
Posts: 14
Registered: ‎09-08-2008
My Device: Not Specified

Re: Background linear gradient to Label?

You don't need override the paint method.

Just try:

Background bgNaranja = BackgroundFactory.createLinearGradientBackground(0

xc14d02, 0xc14d02, 0xeb870e, 0xeb870e);

LabelField lblreiniciar = new LabelField("Mi cuenta", LabelField.USE_ALL_WIDTH);

lblreiniciar.setBackground(bgNaranja);

 

That should be work. I didn't try on LabelFiled objects but works for me with other classes inherited from Field.  Take care about this feature (backgrounds) is available from v4.6 of blackberry O.S.

 

Bruno.

Please use plain text.
Regular Contributor
tnathos
Posts: 92
Registered: ‎07-19-2010
My Device: 8520

Re: Background linear gradient to Label?

nope doesnt works.. my target it 5.0

Please use plain text.
Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Re: Background linear gradient to Label?

He overrides just to change the text's color, that's ok

 

 

You should try to add 00 to your int color, like that:

 

Background bgNaranja = BackgroundFactory.createLinearGradientBackground(0x00c14d02, 0x00c14d02, 0x00eb870e, 0x00eb870e);

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Background linear gradient to Label?

Are you sure it's 00?  00 in alpha channel means "fully transparent".  Try adding FF there (fully opaque).

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.