private TextView tv2;
tv2=(TextView)findViewById(R.id.textView2);
tv2.setOnTouchListener(new CustomTouchListener());
public class CustomTouchListener implements View.OnTouchListener {
public boolean onTouch(View view, MotionEvent motionEvent) {
switch(motionEvent.getAction()){
case MotionEvent.ACTION_DOWN:
Hauteur.setTextSize(TypedValue.COMPLEX_UNIT_PX, 80);
Hauteur.startAnimation(AnimationUtils.loadAnimation(recuperationJson.this, android.R.anim.slide_in_left));
break;
case MotionEvent.ACTION_UP:
// Action you you want on finger up
Hauteur.setTextSize(TypedValue.COMPLEX_UNIT_PX, 60);
break;
}
return true;
}
}
Hallo! Ich möchte das gleiche Motion Event (gleiche Aktionen) auf 5 anderen Textviews durchführen, also muss ich 5 andere öffentliche Klassen CustomTouchListener1,2,3,4,5 erstellen ... oder gibt es eine Möglichkeit, sie alle zu gruppieren?Touch Listener auf mehrere Textviews?
Vielen Dank an alle, chosed i Mushahid Khatri Lösung – AlexMel