Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - [Solved] How to make a gradient color?

[Solved] How to make a gradient color?

Put your problem here if it does not fit any of the other categories.

[Solved] How to make a gradient color?

Postby sasuke » Mon Jan 14, 2008 5:07 am

Hello all,

How to make a gradient color? My code doesn't work... :wink:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.                 int color[] = new int[2];
  3.  
  4.                 color[0] = R.color.green;
  5.  
  6.                 color[1] = R.color.yellow;
  7.  
  8.                
  9.  
  10.                 GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM,color);
  11.  
  12.                 grad.setSize(100,200);
  13.  
  14.                 grad.setColor(R.color.green);          
  15.  
  16.                 grad.setBounds(0, 0, 100, 200);
  17.  
  18.                 grad.setAlpha(255);
  19.  
  20.                 grad.draw(canvas);
  21.  
  22.  
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


Regards,
sasuke
sasuke
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Fri Nov 30, 2007 1:25 pm

Top

Re: How to make a gradient color?

Postby tum0rc0re » Mon Jan 14, 2008 7:53 am

Hi, look it, maybe it helps - http://www.maximyudin.com/?p=19
Btw, what's your canvas? Button? Image? Or else?
JQ Soft web page:
[b][url=http://jqsoft.ru/]http://jqsoft.ru/[/url][/b]
My proffesional blog: [b][url=http://maximyudin.blogspot.com]http://maximyudin.blogspot.com[/url][/b]
Facebook: [b][url=http://www.facebook.com/maxim.yudin]http://www.facebook.com/maxim.yudin[/url][/b]
User avatar
tum0rc0re
Senior Developer
Senior Developer
 
Posts: 158
Joined: Sun Nov 25, 2007 7:15 am
Location: Moscow, Russia

Postby plusminus » Mon Jan 14, 2008 8:11 am

Hello sasuke,

what is wrong with your code, does it show only green :?:

Try simplifying your code. First remove this line:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.           grad.setColor(R.color.green);
Parsed in 0.010 seconds, using GeSHi 1.0.8.4

then this one
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.           grad.setAlpha(255);
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


Tell us if we could help you :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby sasuke » Mon Jan 14, 2008 8:47 am

Hello all,

@tum0rc0re, thank you. it's works now..
tum0rc0re wrote:Btw, what's your canvas? Button? Image? Or else?

I made a class that extends the View (for handling the main menu)...

@plusminus, the problem is, it's not showing anything...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         @Override
  2.         protected void onDraw(Canvas canvas) {
  3.                 drawMenu();            
  4.                 int color[] = new int[2];
  5.                 color[0] = R.color.green;
  6.                 color[1] = R.color.yellow;
  7.                 GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM,color);
  8.                 grad.setSize(100,200); 
  9.                 grad.setBounds(0, 0, 100, 200);
  10.                 grad.draw(canvas);
  11.                 Paint pt = new Paint();
  12.                 canvas.drawBitmap(bmp, 0, 0, pt);
  13.         }
  14.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4

the drawMenu method works great, but the gradient won't appear on the canvas..

Regards,
sasuke
sasuke
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Fri Nov 30, 2007 1:25 pm

Postby plusminus » Mon Jan 14, 2008 5:24 pm

Hello sasuke,

so this issue can be marked as solved :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby sasuke » Tue Jan 15, 2008 1:20 am

@plusminus, yes.. thank you for changing the topic subject :wink: :wink:
sasuke
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Fri Nov 30, 2007 1:25 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests