The high imitation cool dog UI slides the background image left and right without moving and the listview with navigation

Source: Internet
Author: User

To increase user experience, currently many applications can slide the screen left and right,
Another viewpage class is officially provided. It is used to slide the screen between the left and right. Many friends may already be familiar with it.
But most people just take this one for the first startup.Program. However, his functions are more powerful than that.
Currently, many technologies can be used to slide the screen between the left and right. But personally, this is the simplest and most practical. This is one of the official APIs. This class will be upgraded and extended. Only the original version.
A view must be added to the viewpage. Here we reference an XML layout file as a view
For example:
// This view represents a view.
View view1 = This. getlayoutinflater (). Inflate (R. layout. layout1, null );
How can we operate the controls in the layout file after we get this view? It is actually very simple.
// This sentenceCodeWe get the button control that is not centered.
(Button) btn_exit = (button) view1.findviewbyid (R. Id. btn_exit );
Same. As long as the view is used to obtain its control over the XML file

Many may not be clear about this usage. Therefore, you can only use the view page control to initialize the boot.

Code:

// Instantiate the control and view sub-control view1 = This. getlayoutinflater (). inflate (R. layout. layout1, null); view2 = This. getlayoutinflater (). inflate (R. layout. layout2, null); vessel. add (view1); vessel. add (view2); // viewpage Vp = (viewpager) findviewbyid (R. id. viewpagerlayout); // the data source of viewpage, that is, viewmyadapter = new mypageradapter (); VP. setadapter (myadapter); // set the default value of 0 VP. setcurrentitem (0); VP. setonpagechangelistener (New myonpagechangelistener (); cursor = (imageview) findviewbyid (R. id. cursor); main_btn1 = (textview) findviewbyid (R. id. main_btn1); main_btn2 = (textview) findviewbyid (R. id. main_btn2); main_btn1.setonclicklistener (this); main_btn2.setonclicklistener (this); layout%btn_ OK = (button) view1.findviewbyid (R. id. layout_btn_ OK); layout2_btn_ OK = (button) view2.findviewbyid (R. id. layout2_btn_ OK); layout%btn_ OK .setonclicklistener (this); layout2_btn_ OK .setonclicklistener (this );

Okay, let's talk about the source code.

 

 

 

Source code: http://files.cnblogs.com/aimeng/%E4%BB%BF%E9%85%B7%E7%8B%97UI%E5%92%8C%E5%AF%BC%E8%88%AAListView%E5%92%8C%E8%83%8C%E6%99%AF%E5%9B%BE%E4%B8%8D%E5%8A%A8.zip

 

Synchronous sent to: http://www.apkbus.com/android-63882-1-1.html welcome to reply to exchange.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.