Change the background image of listview on Focus?

Add an xml file to manage the background of the LinearLayout list_bg_selector. Xml :? Xml version="1.0" encoding="utf-8"?

Add an xml file to manage the background of the LinearLayout. List_bg_selector. Xml : To manage the text color, set the text color to another xml.

Text_selector.xml.

In getView if(position == focusedPosition) { textView. SetColor(context.getResources(). GetColor(R.color.

Color_for_focused_item); } else { textView. SetColor(context.getResources(). GetColor(R.color.

Color_for_normal_item); }.

– Fortega Aug 4 at 10:38 You should pass it somehow. For example you can set adapter variable. – Maxim Aug 4 at 10:40 From where I get the focusedPosition Maxim – jennifer Aug 4 at 10:41.

Try this listViewContactList. SetOnFocusChangeListener(new OnFocusChangeListener(){ @Override public void onFocusChange(View v, boolean hasFocus) { v. SetBackgroundColor(Color.

BLACK); ImageView img=(ImageView)v. FindViewById(R.id. Callimage); img.

SetImageResource(R.drawable. Yourimage); TextView tv=(TextView)v. FindViewById(R.id.

Your_textview_id); tv. SetBackgroundResource(R.drawable. Your_back); } }).

I need to change the image and also the font color of the text view, how can I do that – jennifer Aug 4 at 10:41 try to use like above.. – Ilango J Aug 4 at 10:47.

I have a table with some rows having a textview and imageview. I am changing the background of row on click using a selector drawable. I also need to change the color of text and the imageview image on click.

The color of the textview needs to be changed on click of the parent table row not on the click of the textview. But it doesn't seem to work.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions