您的位置:首页 > 移动开发 > Android开发

android开发实例-ViewPager

2013-07-19 00:19 274 查看
之前看到的一些切换页面采用的方法是重写onScroll()方法,人工获取手势操作,比如滑动的方向速度等等以此来判断页面切换的方向。这个例子主要是采用ViewPager的方法在同一个activity里切换页面。

1.主界面的布局文件main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#1586FF" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#EEEEEE"
>

<Button
android:id="@+id/json"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#3399FF"
android:text="新建笔记" />

<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000" >
</ListView>
</LinearLayout>
</LinearLayout>


View Code
忘了。附图:


貌似注释写的有点渣渣嘛。。。睡觉去了。明天安心看书。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐