you are right i tried focus state and select state i am using on listview like this want to show
when user clicks on any listview item or select or focus on then it colors would turn into white please have a look at this code public BulletedTextView(Context context, String text, Drawable bullet) { super(context); setBackground(R.drawable.shape_5); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); params.setMargins(5, 3, 5, 0); this.setOrientation(HORIZONTAL); mBullet = new ImageView(context); mBullet.setImageDrawable(bullet); mBullet.setAdjustViewBounds(true); //mBullet.setMaxHeight(32); mBullet.setPadding(10, 5, 10, 0); addView(mBullet, params); mText = new TextView(context); mText.setPadding(0, 0, 0, 10); mText.setText(text); mText.setGravity(Gravity.BOTTOM); /*mText.setTextColor(new ColorStateList( new int[][] { new int[] { android.R.attr.state_pressed}, new int[1], }, new int[] { Color.rgb(255, 255, 255), Color.BLACK, } ));*/ mText.setTextColor(new ColorStateList( new int[][] { new int[] { android.R.attr.state_selected}, new int[1] }, new int[] { Color.rgb(255, 255, 255), Color.BLACK, } )); //mText.setTextColor(R.color.solid_white); //mText.setBackground(R.drawable.tab_indicator); //mText.seti //View tab = ViewInflate.from(context).inflate(R.layout.tab_indicator, this, null); //TextView tv = (TextView)tab.findViewById(R.id.tab_label); addView(mText, new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT)); } On Apr 24, 5:29 am, "Megha Joshi" <[EMAIL PROTECTED]> wrote: > I guess the issue might be that if mText is a TextView, it would not have a > pressed state. > > On Wed, Apr 23, 2008 at 1:42 AM, Greg <[EMAIL PROTECTED]> wrote: > > > i tried it like this > > > mText.setTextColor(new ColorStateList( > > new int[][] { > > new int[] > > { > > android.R.attr.state_selected,android.R.attr.state_focused,android.R.attr.state_pressed}, > > new int[1],new int[1],new int[1], > > }, new int[] > > { > > Color.rgb(255, 255, 255), > > Color.BLACK, > > > } > > )); > > > but it doesnt work for me > > > it doesnt show any effect > > > On Apr 23, 1:16 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote: > > > Please see the thread below for using ColorStateList programatically: > >http://groups.google.com/group/android-developers/msg/6e1fb819cecbc038 > > > > On Wed, Apr 23, 2008 at 1:04 AM, Greg <[EMAIL PROTECTED]> wrote: > > > > > thanks megha > > > > > i have checked it i want to do it pro grammatically > > > > > like this want to check how color state list works for multiple > > > > states? > > > > > mText.setTextColor(new ColorStateList( > > > > new int[][] { > > > > new int[] { android.R.attr.state_selected}, > > > > new int[1] > > > > }, new int[] > > > > { > > > > Color.rgb(255, 255, 255), > > > > Color.BLACK, > > > > > } > > > > )); > > > > > On Apr 23, 12:57 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote: > > > > > Please see the thread below: > > > >http://groups.google.com/group/android-developers/msg/0714e077e25d63a6 > > > > > > Thanks, > > > > > Megha > > > > > > On Wed, Apr 23, 2008 at 12:47 AM, Greg <[EMAIL PROTECTED]> > > wrote: > > > > > > > i am really very sorry Megha > > > > > > > i have searched the groupd i ddint find soultuion > > > > > > > Regards > > > > > > > Greg > > > > > > > On Apr 23, 12:16 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote: > > > > > > > Hi Greg, > > > > > > > > This issue has been discussed on the groups multiple times, > > please > > > > use > > > > > > > search on the groups. > > > > > > > You may also want to avoid using "Urgent" in the subject line > > for > > > > every > > > > > > > post. > > > > > > > > Thanks, > > > > > > > Megha > > > > > > > > On Tue, Apr 22, 2008 at 3:25 AM, Greg <[EMAIL PROTECTED]> > > wrote: > > > > > > > > > how can i use colors for two states > > > > > > > > > HEllo > > > > > > > > > mText.setTextColor(new ColorStateList( > > > > > > > > new int[][] { > > > > > > > > new int[] { > > android.R.attr.state_selected}, > > > > > > > > new int[1] > > > > > > > > }, new int[] > > > > > > > > { > > > > > > > > Color.rgb(255, 255, 255), > > > > > > > > Color.BLACK, > > > > > > > > > } > > > > > > > > )); > > > > > > > > > like i what to use .R.attr.state_pressed then how can i do > > this? > > > > > > > > can any body help me please? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---