Custom Button

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

Custom Button

Postby victorvieux » Sat May 30, 2009 12:37 am

Hi all,

I want to create a custom button class :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class ItemList extends Button {
  3.  
  4.         public ItemList(Context context, String text, int nb) {
  5.  
  6.                 super(context);
  7.  
  8.                 setPadding(0,0,0,0);
  9.  
  10.                 setGravity(Gravity.LEFT);
  11.  
  12.                 setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  13.  
  14.                 setText(text);
  15.  
  16.                 setTextColor(R.color.orange);
  17.  
  18.                 if (nb % 2 == 0)
  19.  
  20.                         setBackgroundResource(R.color.T1);
  21.  
  22.                 else
  23.  
  24.                         setBackgroundResource(R.color.T2);
  25.  
  26.         }
  27.  
  28. }
  29.  
  30.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


But the setTextColor doesn't work (not orange)m any idea ?

Thx
victorvieux
Freshman
Freshman
 
Posts: 2
Joined: Wed May 27, 2009 7:04 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests