If the page is up or down or left and right, we use this open source project: Https://github.com/openaphid/android-flip
Aphid Flipview is a UI component that implements the Flipboard page turn effect.
After the download is complete, import into your current project, and we'll page up and down:
Directly post the code:
Layout file:
<span style= "FONT-SIZE:14PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/ Res/android " android:layout_width=" match_parent " android:layout_height=" match_parent " android:o rientation= "vertical" android:gravity= "center" android:background= "@android: Color/white" > < ImageView android:id= "@+id/tv_number" android:layout_width= "wrap_content" android:layout_height= " Fill_parent " android:gravity=" center " android:scaletype=" Fitxy " /></linearlayout></ Span>
Main file:
<span style= "FONT-SIZE:14PX;" >public class Mainactivity extends Activity {private int[] image=new INT[]{R.DRAWABLE.QD,R.DRAWABLE.QG, R.DRAWABLE.QW};p rivate Context activity=this;protected flipviewcontroller flipviewcontroller; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); flipviewcontroller=new Flipviewcontroller (activity); Flipviewcontroller.setadapter (new Baseadapter ()); Setcontentview (Flipviewcontroller );} public class Baseadapter extends baseadapter{@Overridepublic int GetCount () {//TODO auto-generated method Stubreturn imag E.length;} @Overridepublic Object getItem (int position) {//TODO auto-generated method Stubreturn position;} @Overridepublic long Getitemid (int position) {//TODO auto-generated method Stubreturn position;} @Overridepublic view GetView (int position, view Convertview, ViewGroup parent) {//TODO auto-generated method Stubif (Conve Rtview==null) {convertview=new numbertextveiw (activity);} ((ImageView) (Convertview.findvieWbyid (R.id.tv_number)). Setbackgroundresource (Image[position]); return convertview;}} Private class Numbertextveiw extends Linearlayout{viewholder viewholder;public numbertextveiw (context context) {Super ( context); Inflate (context, r.layout.text_number_view, this); viewholder=new Viewholder (); Viewholder.tv_number= ( ImageView) Findviewbyid (R.id.tv_number);}} Private class Viewholder {public ImageView tv_number;}} </span>
The above is the implementation of the page up and down effect of the code, if you want to implement left and right page changes only one code:
<span style= "FONT-SIZE:14PX;" >flipviewcontroller=new Flipviewcontroller (activity);</span>
Change to:
<span style= "FONT-SIZE:14PX;" >flipviewcontroller=new Flipviewcontroller (this, flipviewcontroller.horizontal);</span>
Reprint Please specify the Source:http://blog.csdn.net/hai_qing_xu_kong/article/details/42215085Emotional Control _
Android's implementation up and down page effect