With the rapid popularization of speech, many applications have begun to increase the voice input function. Below is a simple animation switching between voice and text input:
Layout file:
"
ViewFlipper has many introductions on the Internet
Logical implementation:
ViewFlipper = (ViewFlipper) findViewById (R. id. viewFlipper1); image01 = (ImageView) findViewById (R. id. image01); image02 = (ImageView) findViewById (R. id. image02); leftInAnimation = AnimationUtils. loadAnimation (this, R. anim. left_in); leftOutAnimation = AnimationUtils. loadAnimation (this, R. anim. left_out); image01.setOnClickListener (new OnClickListener () {@ Overridepublic void onClick (View v) {viewFlipper. setInAnimation (leftInAnimation); viewFlipper. setOutAnimation (leftOutAnimation); viewFlipper. showNext (); // slide to the right}); image02.setOnClickListener (new OnClickListener () {@ Overridepublic void onClick (View v) {viewFlipper. setInAnimation (leftInAnimation); viewFlipper. setOutAnimation (leftOutAnimation); viewFlipper. showNext (); // slide to the right }});
Here we only provide some ideas. In fact, we can also use OnGestureListener for gesture slide operations.