怎么获得viewpager获取当前页当前的页码

查看: 4194|回复: 9
怎么获得viewPager当前的页码
签到天数: 4 天连续签到: 1 天[LV.2]偶尔看看I主题帖子e币
怎么获得viewPager当前的页码,我现在做一个项目是一个Viewpager里面放2个xml界面,左右滑动,我想获得当前页是第几页,比如说开始运行时第一页,向左划动一下是第二页,大家谁知道
签到天数: 1 天连续签到: 1 天[LV.1]初来乍到主题帖子e币
vigerpager.getcurrentItem()
我支持: 5 同意楼上&
签到天数: 24 天连续签到: 1 天[LV.4]偶尔看看III主题帖子e币
ViewPager的方法,getcurrentItem可以获取到
该用户从未签到主题帖子e币
vigerpager.getcurrentItem()
这个我用过不行是0&
该用户从未签到主题帖子e币
我的比较复杂,我的是在viewPager里放个LinearLayout,在里面加载图片,在适配器里继承PagerAdapter,用里面的方法instantiateItem()。
((ViewPager) arg0).addView(mviewList.get(arg1));
& & & & & & & & & & & & if (arg1 == mviewList.size() - 1)
就可以得到了。希望对楼主有用!
亲,你这个方法在哪里写&
签到天数: 4 天连续签到: 1 天[LV.2]偶尔看看I主题帖子e币
vigerpager.getcurrentItem()
这个我用过不行是0
签到天数: 4 天连续签到: 1 天[LV.2]偶尔看看I主题帖子e币
我的比较复杂,我的是在viewPager里放个LinearLayout,在里面加载图片,在适配器里继承PagerAdapter,用里面 ...
亲,你这个方法在哪里写
该用户从未签到主题帖子e币
package com.bawei.cosmetics.
import java.util.ArrayL
import android.os.B
import android.os.P
import android.support.v4.view.PagerA
import android.support.v4.view.ViewP
import android.support.v4.view.ViewPager.OnPageChangeL
import android.view.LayoutI
import android.view.V
import android.view.View.OnClickL
import android.view.ViewG
import android.view.ViewGroup.LayoutP
import android.view.W
import android.widget.B
import android.widget.ImageV
import android.app.A
import android.content.I
public class GreetActivity extends Activity {
& & & & private Button mB
& & & & private ViewPager mviewP
& & & & private ArrayList&View& mviewL// 主界面的列表
& & & & private ViewGroup main,
& & & & private ImageView mimageV
& & & & private ImageView[] mimageV// 导航条的数量
& & & & @Override
& & & & protected void onCreate(Bundle savedInstanceState) {
& & & & & & & & super.onCreate(savedInstanceState);
& & & & & & & & this.requestWindowFeature(Window.FEATURE_NO_TITLE);
& & & & & & & & // -------------1为页适配器准备页面数据
& & & & & & & & LayoutInflater inflater = getLayoutInflater();
& & & & & & & & mviewList = new ArrayList&View&();// 存下列四个主界面布局-------!!!
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item01, null));
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item02, null));
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item03, null));
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item04, null));
& & & & & & & & main = (ViewGroup) inflater.inflate(R.layout.activity_main, null);
& & & & & & & & // group是R.layou.main中的负责包裹小圆点的LinearLayout.
& & & & & & & & group = (ViewGroup) main.findViewById(R.id.viewGroup);
& & & & & & & & // 下面是android.support.v4.view.ViewPager组件
& & & & & & & & mviewPager = (ViewPager) main.findViewById(R.id.guidePages);
& & & & & & & & // 根据主界面的数量来决定导航条的图标数
& & & & & & & & mimageViews = new ImageView[mviewList.size()];
& & & & & & & & // 设定导航样式小图标
& & & & & & & & for (int i = 0; i & mviewList.size(); i++) {
& & & & & & & & & & & & mimageView = new ImageView(this);
& & & & & & & & & & & & // LayoutParams两个参数,第一个长,第二个高。
& & & & & & & & & & & & mimageView.setLayoutParams(new LayoutParams(10, 10));
& & & & & & & & & & & & mimageView.setPadding(10, 0, 10, 0);
& & & & & & & & & & & & mimageViews[i] = mimageV
& & & & & & & & & & & & // 把n个创建的小图标存到imageViews[View]中
& & & & & & & & & & & & if (i == 0) {
& & & & & & & & & & & & & & & & // 默认选中第一张图片
& & & & & & & & & & & & & & & & mimageViews[i].setBackgroundResource(R.drawable.stop2);
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & mimageViews[i].setBackgroundResource(R.drawable.stop1);
& & & & & & & & & & & & }
& & & & & & & & & & & & group.addView(mimageViews[i]);// 分别添加到导航中LinearLayout条中
& & & & & & & & }
& & & & & & & & setContentView(main);
& & & & & & & & /* 对ViewPager进行适配,并添加页面切换监听器 */
& & & & & & & & mviewPager.setAdapter(new GuidePageAdapter());
& & & & & & & & mviewPager.setOnPageChangeListener(new GuidePageChangeListener());// 页面改变监听器
& & & & /** 页面Adapter */
& & & & class GuidePageAdapter extends PagerAdapter {
& & & & & & & & @Override
& & & & & & & & public int getCount() {
& & & & & & & & & & & & return mviewList.size();
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public boolean isViewFromObject(View arg0, Object arg1) {
& & & & & & & & & & & & return arg0 == arg1;
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public int getItemPosition(Object object) {
& & & & & & & & & & & & return super.getItemPosition(object);
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void destroyItem(View arg0, int arg1, Object arg2) {
& & & & & & & & & & & & ((ViewPager) arg0).removeView(mviewList.get(arg1));
& & & & & & & & }
& & & & & & & & // 导航最后一页按钮
& & & & & & & & @Override
& & & & & & & & public Object instantiateItem(View arg0, int arg1) {
& & & & & & & & & & & & ((ViewPager) arg0).addView(mviewList.get(arg1));
& & & & & & & & & & & & if (arg1 == mviewList.size() - 1) {
& & & & & & & & & & & & & & & & mButton = (Button) findViewById(R.id.button1);
& & & & & & & & & & & & & & & & mButton.setOnClickListener(new OnClickListener() {
& & & & & & & & & & & & & & & & & & & & @Override
& & & & & & & & & & & & & & & & & & & & public void onClick(View v) {
& & & & & & & & & & & & & & & & & & & & & & & & Intent intent = new Intent(GreetActivity.this,
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & MainActivity.class);
& & & & & & & & & & & & & & & & & & & & & & & & startActivity(intent);
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & });
& & & & & & & & & & & & }
& & & & & & & & & & & & return mviewList.get(arg1);
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void restoreState(Parcelable arg0, ClassLoader arg1) {
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public Parcelable saveState() {
& & & & & & & & & & & &
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void startUpdate(View arg0) {
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void finishUpdate(View arg0) {
& & & & & & & & }
& & & & /** 指引页面改变监听器 */
& & & & class GuidePageChangeListener implements OnPageChangeListener {
& & & & & & & & @Override
& & & & & & & & public void onPageScrollStateChanged(int arg0) {
& & & & & & & & & & & & // TODO Auto-generated method stub
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void onPageScrolled(int arg0, float arg1, int arg2) {
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void onPageSelected(int arg0) {
& & & & & & & & & & & & for (int i = 0; i & mimageViews. i++) {
& & & & & & & & & & & & & & & & mimageViews[arg0].setBackgroundResource(R.drawable.stop2);
& & & & & & & & & & & & & & & & if (arg0 != i) {
& & & & & & & & & & & & & & & & & & & & mimageViews[i].setBackgroundResource(R.drawable.stop1);
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & }
& & & & & & & & }
该用户从未签到主题帖子e币
亲,你这个方法在哪里写
package com.bawei.cosmetics.
import java.util.ArrayL
import android.os.B
import android.os.P
import android.support.v4.view.PagerA
import android.support.v4.view.ViewP
import android.support.v4.view.ViewPager.OnPageChangeL
import android.view.LayoutI
import android.view.V
import android.view.View.OnClickL
import android.view.ViewG
import android.view.ViewGroup.LayoutP
import android.view.W
import android.widget.B
import android.widget.ImageV
import android.app.A
import android.content.I
public class GreetActivity extends Activity {
& & & & private Button mB
& & & & private ViewPager mviewP
& & & & private ArrayList&View& mviewL// 主界面的列表
& & & & private ViewGroup main,
& & & & private ImageView mimageV
& & & & private ImageView[] mimageV// 导航条的数量
& & & & @Override
& & & & protected void onCreate(Bundle savedInstanceState) {
& & & & & & & & super.onCreate(savedInstanceState);
& & & & & & & & this.requestWindowFeature(Window.FEATURE_NO_TITLE);
& & & & & & & & // -------------1为页适配器准备页面数据
& & & & & & & & LayoutInflater inflater = getLayoutInflater();
& & & & & & & & mviewList = new ArrayList&View&();// 存下列四个主界面布局-------!!!
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item01, null));
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item02, null));
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item03, null));
& & & & & & & & mviewList.add(inflater.inflate(R.layout.item04, null));
& & & & & & & & main = (ViewGroup) inflater.inflate(R.layout.activity_main, null);
& & & & & & & & // group是R.layou.main中的负责包裹小圆点的LinearLayout.
& & & & & & & & group = (ViewGroup) main.findViewById(R.id.viewGroup);
& & & & & & & & // 下面是android.support.v4.view.ViewPager组件
& & & & & & & & mviewPager = (ViewPager) main.findViewById(R.id.guidePages);
& & & & & & & & // 根据主界面的数量来决定导航条的图标数
& & & & & & & & mimageViews = new ImageView[mviewList.size()];
& & & & & & & & // 设定导航样式小图标
& & & & & & & & for (int i = 0; i & mviewList.size(); i++) {
& & & & & & & & & & & & mimageView = new ImageView(this);
& & & & & & & & & & & & // LayoutParams两个参数,第一个长,第二个高。
& & & & & & & & & & & & mimageView.setLayoutParams(new LayoutParams(10, 10));
& & & & & & & & & & & & mimageView.setPadding(10, 0, 10, 0);
& & & & & & & & & & & & mimageViews = mimageV
& & & & & & & & & & & & // 把n个创建的小图标存到imageViews[View]中
& & & & & & & & & & & & if (i == 0) {
& & & & & & & & & & & & & & & & // 默认选中第一张图片
& & & & & & & & & & & & & & & & mimageViews.setBackgroundResource(R.drawable.stop2);
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & mimageViews.setBackgroundResource(R.drawable.stop1);
& & & & & & & & & & & & }
& & & & & & & & & & & & group.addView(mimageViews);// 分别添加到导航中LinearLayout条中
& & & & & & & & }
& & & & & & & & setContentView(main);
& & & & & & & & /* 对ViewPager进行适配,并添加页面切换监听器 */
& & & & & & & & mviewPager.setAdapter(new GuidePageAdapter());
& & & & & & & & mviewPager.setOnPageChangeListener(new GuidePageChangeListener());// 页面改变监听器
& & & & /** 页面Adapter */
& & & & class GuidePageAdapter extends PagerAdapter {
& & & & & & & & @Override
& & & & & & & & public int getCount() {
& & & & & & & & & & & & return mviewList.size();
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public boolean isViewFromObject(View arg0, Object arg1) {
& & & & & & & & & & & & return arg0 == arg1;
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public int getItemPosition(Object object) {
& & & & & & & & & & & & return super.getItemPosition(object);
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void destroyItem(View arg0, int arg1, Object arg2) {
& & & & & & & & & & & & ((ViewPager) arg0).removeView(mviewList.get(arg1));
& & & & & & & & }
& & & & & & & & // 导航最后一页按钮
& & & & & & & & @Override
& & & & & & & & public Object instantiateItem(View arg0, int arg1) {
& & & & & & & & & & & & ((ViewPager) arg0).addView(mviewList.get(arg1));
& & & & & & & & & & & & if (arg1 == mviewList.size() - 1) {
& & & & & & & & & & & & & & & & mButton = (Button) findViewById(R.id.button1);
& & & & & & & & & & & & & & & & mButton.setOnClickListener(new OnClickListener() {
& & & & & & & & & & & & & & & & & & & & @Override
& & & & & & & & & & & & & & & & & & & & public void onClick(View v) {
& & & & & & & & & & & & & & & & & & & & & & & & Intent intent = new Intent(GreetActivity.this,
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & MainActivity.class);
& & & & & & & & & & & & & & & & & & & & & & & & startActivity(intent);
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & });
& & & & & & & & & & & & }
& & & & & & & & & & & & return mviewList.get(arg1);
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void restoreState(Parcelable arg0, ClassLoader arg1) {
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public Parcelable saveState() {
& & & & & & & & & & & &
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void startUpdate(View arg0) {
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void finishUpdate(View arg0) {
& & & & & & & & }
& & & & /** 指引页面改变监听器 */
& & & & class GuidePageChangeListener implements OnPageChangeListener {
& & & & & & & & @Override
& & & & & & & & public void onPageScrollStateChanged(int arg0) {
& & & & & & & & & & & & // TODO Auto-generated method stub
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void onPageScrolled(int arg0, float arg1, int arg2) {
& & & & & & & & }
& & & & & & & & @Override
& & & & & & & & public void onPageSelected(int arg0) {
& & & & & & & & & & & & for (int i = 0; i & mimageViews. i++) {
& & & & & & & & & & & & & & & & mimageViews[arg0].setBackgroundResource(R.drawable.stop2);
& & & & & & & & & & & & & & & & if (arg0 != i) {
& & & & & & & & & & & & & & & & & & & & mimageViews.setBackgroundResource(R.drawable.stop1);
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & }
& & & & & & & & }
推荐阅读热门话题
619901845415415374321273263257253249234224215715
24&分钟前半小时前1&小时前4&小时前4&小时前4&小时前5&小时前5&小时前5&小时前5&小时前5&小时前6&小时前6&小时前6&小时前7&小时前7&小时前
Powered by怎么获得viewPager当前的页码_百度知道
怎么获得viewPager当前的页码
提问者采纳
监听viewpager的滑动事件 在onPageSelected里记录下页码就好了
来自团队:
其他类似问题
为您推荐:
页码的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁【React Native开发】React Native控件之ViewPagerAndroid讲解以及美团首页顶部效果实例(17)
【React Native开发】React Native控件之ViewPagerAndroid讲解以及美团首页顶部效果实例(17)
[摘要:转载请标明出处:http://blog.csdn.net/developer_jiangqq/article/details/本文出自:【江浑浑的专客】(一)媒介
【好音讯】小我网站已上线运转,背面专客和]
转载请标明出处:http://blog.csdn.net/developer_jiangqq/article/details/本文出自:【江清清的博客】(一)前言& & & &【好消息】个人网站已经上线运行,后面博客以及技术干货等精彩文章会同步更新,请大家关注收藏:http://www.lcode.org&&&&&&&& & & 今天我们一起来看一下ViewPagerAndroid组件完成解析以及仿照实现美团首页顶部效果。&&&&&&&& 刚创建的React Native技术交流群(),欢迎各位大牛,React Native技术爱好者加入交流!同时博客左侧欢迎微信扫描关注订阅号,移动技术干货,精彩文章技术推送!&&&&&&&&& 说到React Native for Android版本中的ViewPagerAndroid组件和Android中的ViewPager控件作用相类似。该容器允许容器中的子视图相互的左右滑动。每一个ViewPagerAndroid中的子视图都会当做一个单独的页面,并且会撑满整个ViewPagerAndroid组件的界面。&&&&& 【特别注意】ViewPagerAndroid中的所有子View必须为&View&控件,不能为复合型的组件。你可以为每一个子视图添加列如:padding或则backgroundColor之类的属性。(二)官方实例&&&&&&&&& 如果你学过Android或者Web前端开发,对这样的ViewPagerAndroid组件还是比较容易学的,该组件我们可以做广告轮播等相关效果哦~&&&&&&&& 首先我们来看一下官方给我们的实例(本人做过相应修改),具体代码如下:'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
ViewPagerAndroid,
} from'react-native';
class ViewPagerDemoextends Component {
render() {
&Text style={styles.welcome}&
ViewPagerAndroid实例
&ViewPagerAndroidstyle={styles.pageStyle} initialPage={0}&
&Viewstyle={{backgroundColor:&red&}}&
&Text&FirstPage!&/Text&
&Viewstyle={{backgroundColor:&yellow&}}&
&Text&SecondPage!&/Text&
&/ViewPagerAndroid&
const styles =StyleSheet.create({
pageStyle: {
alignItems: 'center',
padding: 20,
height:200,
AppRegistry.registerComponent('ViewPagerDemo',() =& ViewPagerDemo);该官方实例运行效果如下:(三)属性方法 View相关属性样式全部继承(例如:宽和高,背景颜色,边距等相关属性样式) initialPage& number&
ViewPagerAndroid初始索引页,不过我们可以使用setPage方法来更新页码,通过onPageSelected方法来监听页面滑动。 keyboardDismissMode& enum('none','on-drag')& 枚举类型,进行设置在拖拽滑动的过程中是否要显示键盘。&&&&&'none'&默认值,在拖拽中不隐藏键盘&&&&&'on-drag'&& 当拖拽滑动开始的时候隐藏键盘 onPageScroll& function 方法,该方法在页面进行滑动的时候执行(不管是因为页面滑动动画原因还是由于页面之间的拖拽以及滑动原因).该会回调传入的event.nativeEvent对象会有携带如下参数:&&&&&'position'&&从左起开始第一个可见的页面的索引&&&&&'offset'& 该value值的范围为[0,1),该用来代表当前页面的却换的状态。值x代表该索引页面(1-x)的范围可见,另外x范围代表下一个页面可见的区域 onPageScrollStateChanged& function 该回调方法会在页面滚动状态发生变化的时候进行调用。页面的滚动状态有下面三种情况:&& &&&&&&'idle' 该表示当前用户和页面滚动没有任何交互&&&&&&'dragging'& 拖动中,该表示当前页面正在被拖拽滑动中&&&&&&'settling'&& 该表示存在页面拖拽或者滑动的交互。页面滚动正在结束。并且正在关闭或者打开动画。 onPageSelected& function 方法 该在页面进行拖拽滑动切换完成之后回调。该方法回调参数中的event.nativeEvent对象会携带如下一个属性 : 'position'& 该属性代表当前选中的页面的索引.(四)ViewPagerAndroid使用实例 &&&&&&&& 上面我们已经对于ViewPagerAndroid组件的基本介绍实例以及相关的属性方法做了详细讲解了,下面我们来返照实现美团首页顶部分类切换页面。首先我们分析一下美团首页顶部效果,该包含美团的业务Item入口,该每个页面包含十大版本,一共两个页面可以进行左右滑动切换。下面来看一下具体代码:/**
* @autor:江清清
* 模仿实现美团首页顶部分类item功能效果实例
* /facebook/react-native
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
ViewPagerAndroid,
} from'react-native';
var titles_first_data=[&美食&,&电影&,&酒店&,&KTV&,&外卖&,&优惠买单&,&周边游&,&休闲娱乐&,&今日新单&,&丽人&];
var titles_second_data=[&购物&,&火车票&,&生活服务&,&旅游&,&汽车服务&,&足疗按摩&,&小吃快餐&,&经典门票&,&境外游&,&全部分类&];
var ViewPagerDemo =React.createClass({
getInitialState: function() {
onPageSelected: function(e) {
this.setState({page:1+e.nativeEvent.position});
render() {
&Text style={{textAlign:'center'}}&
美团首页顶部效果实例
&ViewPagerAndroid style={styles.pageStyle} initialPage={0} onPageSelected={this.onPageSelected}&
&View style={{flexDirection:'row'}}&
&View style={{width:70}}&
&Image source={require('./img/one.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[0]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/two.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[1]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/three.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[2]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/four.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[3]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/five.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[4]}&/Text&
&Viewstyle={{flexDirection:'row',marginTop:10}}&
&View style={{width:70}}&
&Image source={require('./img/six.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[5]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/seven.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[6]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/eight.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[7]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/nine.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[8]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/ten.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_first_data[9]}&/Text&
&View style={{flexDirection:'row'}}&
&View style={{width:70}}&
&Image source={require('./img/next_one.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[0]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_two.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[1]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_three.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[2]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_four.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[3]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_five.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[4]}&/Text&
&Viewstyle={{flexDirection:'row',marginTop:10}}&
&View style={{width:70}}&
&Image source={require('./img/next_six.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[5]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_seven.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[6]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_eight.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[7]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_nine.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[8]}&/Text&
&View style={{width:70}}&
&Image source={require('./img/next_ten.png')} style={styles.imageStyle} /&
&Text style={styles.textStyle}&{titles_second_data[9]}&/Text&
&/ViewPagerAndroid&
&Text style={{flex:1,alignSelf:'center'}}&当前第{this.state.page}页&/Text&
const styles =StyleSheet.create({
pageStyle: {
marginTop:10,
alignItems: 'center',
height:150,
textStyle:{
marginTop:5,alignSelf:'center',fontSize:11,color:'#555555',textAlign:'center'
imageStyle:{
alignSelf:'center',width:45,height:45
AppRegistry.registerComponent('ViewPagerDemo',() =& ViewPagerDemo);具体运行效果如下:(五)最后总结&&&&&&&&& 今天我们主要学习一下ViewPagerAndroid组件使用讲解以及仿照实现美团首页顶部功能页面切换效果。大家有问题可以加一下群React Native技术交流群()或者底下进行回复一下。& & & & 尊重原创,转载请注明:From Sky丶清(http://blog.csdn.net/developer_jiangqq ) 侵权必究!& & & &关注我的订阅号(codedev123),每天分享移动开发技术(Android/IOS),项目管理以及博客文章!(欢迎关注,第一时间推送精彩文章)& & &关注我的微博,可以获得更多精彩内容& & &&&& & & & &&
感谢关注 Ithao123Android频道,是专门为互联网人打造的学习交流平台,全面满足互联网人工作与学习需求,更多互联网资讯尽在 IThao123!
Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework)。它可以让你从面条一样杂乱的代码中解脱出来;它可以帮你构建一个完美的网络APP,而且每行代码都可以简洁、富于表达力。
Hadoop是一个由Apache基金会所开发的分布式系统基础架构。
用户可以在不了解分布式底层细节的情况下,开发分布式程序。充分利用集群的威力进行高速运算和存储。
Hadoop实现了一个分布式文件系统(Hadoop Distributed File System),简称HDFS。HDFS有高容错性的特点,并且设计用来部署在低廉的(low-cost)硬件上;而且它提供高吞吐量(high throughput)来访问应用程序的数据,适合那些有着超大数据集(large data set)的应用程序。HDFS放宽了(relax)POSIX的要求,可以以流的形式访问(streaming access)文件系统中的数据。
Hadoop的框架最核心的设计就是:HDFS和MapReduce。HDFS为海量的数据提供了存储,则MapReduce为海量的数据提供了计算。
产品设计是互联网产品经理的核心能力,一个好的产品经理一定在产品设计方面有扎实的功底,本专题将从互联网产品设计的几个方面谈谈产品设计
随着国内互联网的发展,产品经理岗位需求大幅增加,在国内,从事产品工作的大部分岗位为产品经理,其实现实中,很多从事产品工作的岗位是不能称为产品经理,主要原因是对产品经理的职责不明确,那产品经理的职责有哪些,本专题将详细介绍产品经理的主要职责
IThao123周刊}

我要回帖

更多关于 viewpager 当前页面 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信