Now I want to achieve such an effect. Below is a list of a ListView when touching an item, the background color will be green,
ImageView will change the icon, TextView text turns red, will restore the original state when the finger is removed.


If you just change the background color better get some, you can set the selector for the ListView, but also to change the contents of the Item currently controls more trouble, I thought using onTouch () event can get
But after setting, ListView click event itself will be masked. Depressed ......
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Looks like with this property?
android: drawSelectorOnTop = "false"
Reply:
/>
Or:
Code states listview.setCacheColorHint (0);
Reply:
mListView.setOnItemClickListener (new OnItemClickListener () {
public void onItemClick (AdapterView arg0, View v,
int position, long arg3) {
v.setBackgroundColor (Color.BLUE);
}
}
Reply:
1st floor, 2nd floor did not understand what I mean, ah, 3rd Floor understand, but this is not possible, OnItemClickListener is clicked state,
My demand is generated when pressing the change, but still thank you for your answer
Reply:
listview.setOnItemClickListener ();
Reply:
Set selector is not, modify the ListView adapter, the control object getview () to take to deal with the effects of treatment carried out.
Reply:
Online ...
Reply:
Allows listeners OnTouchListener
listview
list.setOnTouchListener (new OnTouchListener () {
@ Override
public boolean onTouch (View v, MotionEvent event) {
/ / TODO Auto-generated method stub
switch (event.getAction ()) {
case MotionEvent.ACTION_DOWN:
Toast.makeText (ListViewTween.this, "down", 1000) show ();.
break;
default:
break;
}
return false;
}
});
Then you put in the Case View stronger inside into listview, and then change its properties can be!
Reply:
This can
Reply:
Oh, I did not read all, did not pay attention also to restore the original state hands off
Reply:
do not know if this.
Reply:
Landlord, you also unfair it is that I say listen OnTouch first event, but also help you to press events somehow, I had 5 points, 11th Floor, 11 points?
Reply:
Up next to you on the
Reply:
great!
No comments:
Post a Comment