Clicked Buttons Are Orange

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Clicked Buttons Are Orange

Postby darolla » Fri Dec 12, 2008 6:40 pm

Hello,

I need something not so special. I've got a view with many buttons, and I want the user to click them.

After been clicked they have to show the user their click state.

ToggleButtons are wrong because I cannot change the text.

CheckBoxes are wrong because they take too much space.

The first idea I had was to change the textcolor.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         protected class ButtonListener implements OnClickListener {
  3.  
  4.                 public void onClick(View v) {
  5.  
  6.                         Button b = (Button)v;
  7.  
  8.                         int def = b.getTextColors().getDefaultColor();
  9.  
  10.                         int col = Color.rgb(0xe3, 0x55, 0x01);
  11.  
  12.                        
  13.  
  14.                         if( def == col ) {
  15.  
  16.                                 b.setTextColor( Color.rgb(0x00, 0x00, 0x00) );
  17.  
  18.                         }
  19.  
  20.                         else {
  21.  
  22.                                 b.setTextColor( Color.rgb(0xe3, 0x55,0x01) );  
  23.  
  24.                         }
  25.  
  26.                 }
  27.  
  28.         }
  29.  
  30.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


Is there a chance to change the background like the typical orange way?

Something like button.setHighlight( true ) or button.pleaseBecomeOrange( now() ) :D

Greetings,
Marco
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

Postby Quetzalcoatl » Fri Dec 12, 2008 10:16 pm

Hi Darolla,

Is this of any use?

Button background image
Image
Quetzalcoatl
Senior Developer
Senior Developer
 
Posts: 129
Joined: Sat Oct 18, 2008 8:21 pm
Location: near Manchester, UK

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests