List of usage examples for android.widget RelativeLayout ALIGN_PARENT_BOTTOM
int ALIGN_PARENT_BOTTOM
To view the source code for android.widget RelativeLayout ALIGN_PARENT_BOTTOM.
Click Source Link
From source file:com.ab.view.sliding.AbSlidingPlayView.java
/** * ???View./*w w w . j av a 2 s . c om*/ * * @param context the context */ public void initView(Context context) { this.context = context; navLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); this.setBackgroundColor(Color.rgb(255, 255, 255)); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new AbInnerViewPager(context); //ViewPager,fragmentsetId()id mViewPager.setId(1985); // mNavLayoutParent = new LinearLayout(context); mNavLayoutParent.setPadding(0, 5, 0, 5); navLinearLayout = new LinearLayout(context); navLinearLayout.setPadding(15, 1, 15, 1); navLinearLayout.setVisibility(View.INVISIBLE); mNavLayoutParent.addView(navLinearLayout, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mNavLayoutParent, lp2); addView(mRelativeLayout, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); displayImage = AbFileUtil.getBitmapFromSrc("image/play_display.png"); hideImage = AbFileUtil.getBitmapFromSrc("image/play_hide.png"); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }
From source file:com.tony.selene.sliding.AbSlidingPlayView.java
/** * ???View.//from w w w . ja va 2 s .c o m * * @param context * the context */ public void initView(Context context) { this.context = context; navLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new AbInnerViewPager(context); // ViewPager,fragmentsetId()id mViewPager.setId(1985); // mNavLayoutParent = new LinearLayout(context); mNavLayoutParent.setPadding(0, 5, 0, 5); navLinearLayout = new LinearLayout(context); navLinearLayout.setPadding(15, 1, 15, 1); navLinearLayout.setVisibility(View.INVISIBLE); mNavLayoutParent.addView(navLinearLayout, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mNavLayoutParent, lp2); addView(mRelativeLayout, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }
From source file:com.wll.main.widget.AbSlidingPlayView.java
/** * ???View./*w ww . j a v a 2 s. c om*/ * * @param context * the context */ public void initView(Context context) { this.context = context; navLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); this.setBackgroundColor(Color.rgb(255, 255, 255)); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new AbInnerViewPager(context); // ViewPager,fragmentsetId()id mViewPager.setId(getResources().getInteger(R.integer.id_viewPager)); // mNavLayoutParent = new LinearLayout(context); mNavLayoutParent.setPadding(0, 5, 0, 5); navLinearLayout = new LinearLayout(context); navLinearLayout.setPadding(15, 1, 15, 1); navLinearLayout.setVisibility(View.INVISIBLE); mNavLayoutParent.addView(navLinearLayout, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mNavLayoutParent, lp2); addView(mRelativeLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); // displayImage = AbFileUtil.getBitmapFromSrc("image/play_display.png"); // hideImage = AbFileUtil.getBitmapFromSrc("image/play_hide.png"); Bitmap bm = BitmapFactory.decodeResource(context.getResources(), R.mipmap.d2); Bitmap bm2 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.d1); displayImage = bm; hideImage = bm2; mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }
From source file:com.lxh.util.pullview.AbSlidingPlayView.java
/** * ???View.//from w w w . j ava2s . c om * * @param context * the context */ public void initView(Context context) { this.context = context; navLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new AbInnerViewPager(context); // ViewPager,fragmentsetId()id mViewPager.setId(1985); // mNavLayoutParent = new LinearLayout(context); mNavLayoutParent.setPadding(0, 5, 0, 5); navLinearLayout = new LinearLayout(context); navLinearLayout.setPadding(15, 1, 15, 1); navLinearLayout.setVisibility(View.INVISIBLE); mNavLayoutParent.addView(navLinearLayout, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mNavLayoutParent, lp2); addView(mRelativeLayout, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); displayImage = FileUtil.getBitmapFromSrc("image/play_display.png"); hideImage = FileUtil.getBitmapFromSrc("image/play_hide.png"); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }
From source file:com.telenav.expandablepager.ExpandablePager.java
/** * Move the layout to the bottom of the screen in case it was not moved in the xml file *//*from ww w .j av a 2 s .com*/ private void pinToBottom() { ViewGroup.LayoutParams params = getLayoutParams(); if (params != null) { if (params instanceof RelativeLayout.LayoutParams) { ((LayoutParams) params).addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } else if (params instanceof LinearLayout.LayoutParams) { ((LinearLayout.LayoutParams) params).gravity = Gravity.BOTTOM; } else if (params instanceof FrameLayout.LayoutParams) { ((FrameLayout.LayoutParams) params).gravity = Gravity.BOTTOM; } } }
From source file:mobisocial.musubi.ui.FeedIdentityGrid.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //TODO: this begs for being in util, huh. i wonder where else it is used. //check that we aren't going to send a message using the local authority //to our friends. This is similar to the initial hidden state of the //person picker on the feed list mDatabaseSource = App.getDatabaseSource(this); mIdentitiesManager = new IdentitiesManager(mDatabaseSource); mFeedManager = new FeedManager(mDatabaseSource); if (mIdentitiesManager.getOwnedIdentities().size() < 2) { Toast.makeText(this, "You must connect an account in Musubi to be able to share with your contacts", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, FeedListActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);// w w w.jav a 2 s . com return; } setTitle("Share"); RelativeLayout window = new RelativeLayout(this); LayoutParams fill = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); window.setLayoutParams(fill); // Identity multi-select mIdentitySelector = new MultiIdentitySelector(this); mIdentitySelector.setOnIdentitiesUpdatedListener(mIdentitiesUpdatedListener); mIdentitySelector.setOnRequestAddIdentityListener(mOnRequestAddIdentityListener); RelativeLayout.LayoutParams selectorParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); selectorParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); mIdentitySelector.setLayoutParams(selectorParams); mIdentitySelector.setId(R.id.people); // Feed list mFeedListView = new ListView(this); RelativeLayout.LayoutParams listParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); listParams.addRule(RelativeLayout.BELOW, R.id.people); listParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); mFeedListView.setLayoutParams(listParams); mFeedListView.setOnItemClickListener(mFeedClickListener); // Must be called before setAdapter(): //mFeedListView.addHeaderView(mHeaderView); // Bind to content view window.addView(mIdentitySelector); window.addView(mFeedListView); setContentView(window, fill); getSupportLoaderManager().initLoader(LOAD_FEEDS, null, this); }
From source file:com.githang.androidkit.app.IntroActivity.java
/** * /* ww w. j a v a2 s .c o m*/ */ private void createContentView() { // ? mIntroResource = new IntroResource(); setIntroViews(mIntroResource); // RelativeLayout rootView = new RelativeLayout(this); rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); // mViewPager = new ViewPager(this); RelativeLayout.LayoutParams pagerParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); rootView.addView(mViewPager, pagerParams); // LinearLayout indicatorLayout = new LinearLayout(this); RelativeLayout.LayoutParams indicatorParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); indicatorParams.bottomMargin = mIntroResource.indicatorMarginBottom; indicatorParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); indicatorParams.addRule(RelativeLayout.CENTER_HORIZONTAL); indicatorLayout.setLayoutParams(indicatorParams); indicatorLayout.setOrientation(LinearLayout.HORIZONTAL); // int indicatorCount = mIntroResource.views.size(); int padding = mIntroResource.indicatorImagePadding; mIndicator = new ArrayList<ImageView>(); for (int i = 0; i < indicatorCount; i++) { ImageView imageView = new ImageView(this); LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); imageView.setPadding(padding, padding, padding, padding); imageView.setClickable(true); imageView.setOnClickListener(this); imageView.setImageResource(mIntroResource.indicatorNoSelectedId); imageView.setTag(i); mIndicator.add(imageView); indicatorLayout.addView(imageView, imageParams); } rootView.addView(indicatorLayout); setContentView(rootView); }
From source file:com.lurencun.cfuture09.androidkit.uilibs.IntroActivity.java
/** * // w w w .j a v a 2 s .c o m */ private void createContentView() { // ? mIntroResource = new IntroResource(); setIntroViews(mIntroResource); // RelativeLayout rootView = new RelativeLayout(this); rootView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // mViewPager = new ViewPager(this); RelativeLayout.LayoutParams pagerParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); rootView.addView(mViewPager, pagerParams); // LinearLayout indicatorLayout = new LinearLayout(this); RelativeLayout.LayoutParams indicatorParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); indicatorParams.bottomMargin = mIntroResource.indicatorMarginBottom; indicatorParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); indicatorParams.addRule(RelativeLayout.CENTER_HORIZONTAL); indicatorLayout.setLayoutParams(indicatorParams); indicatorLayout.setOrientation(LinearLayout.HORIZONTAL); // int indicatorCount = mIntroResource.views.size(); int padding = mIntroResource.indicatorImagePadding; mIndicator = new ArrayList<ImageView>(); for (int i = 0; i < indicatorCount; i++) { ImageView imageView = new ImageView(this); LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); imageView.setPadding(padding, padding, padding, padding); imageView.setClickable(true); imageView.setOnClickListener(this); imageView.setImageResource(mIntroResource.indicatorNoSelectedId); imageView.setTag(i); mIndicator.add(imageView); indicatorLayout.addView(imageView, imageParams); } rootView.addView(indicatorLayout); setContentView(rootView); }
From source file:io.imoji.sdk.grid.ui.ResultView.java
public ResultView(Context context, @ResultViewSize int viewSize) { super(context); this.context = context; this.viewSize = viewSize; int resultWidth = getDimension(0); int resultHeight = getDimension(1); setLayoutParams(new StaggeredGridLayoutManager.LayoutParams(resultWidth, resultHeight)); placeholder = new ImageView(context); int placeholderSide = getDimension(4); RelativeLayout.LayoutParams placeholderParams = new LayoutParams(placeholderSide, placeholderSide); placeholderParams.addRule(RelativeLayout.CENTER_IN_PARENT); placeholder.setLayoutParams(placeholderParams); addView(placeholder);/*from w w w. j a va2 s . c o m*/ container = new RelativeLayout(context); addView(container, new LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); final Animation pressedAnimation = AnimationUtils.loadAnimation(context, R.anim.search_result_pressed); final Animation releasedAnimation = AnimationUtils.loadAnimation(context, R.anim.search_result_released); imageView = new GifImageView(context) { @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (searchResult != null && !searchResult.isCategory()) { imageView.startAnimation(pressedAnimation); } break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: if (searchResult != null && !searchResult.isCategory()) { imageView.startAnimation(releasedAnimation); } break; } return super.onTouchEvent(event); } }; RelativeLayout.LayoutParams imageParams = new LayoutParams(resultWidth, resultWidth); imageParams.addRule(RelativeLayout.CENTER_IN_PARENT); imageView.setLayoutParams(imageParams); container.addView(imageView); textView = new TextView(context); int titleHeight = getDimension(2); RelativeLayout.LayoutParams titleParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, titleHeight); titleParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); textView.setLayoutParams(titleParams); textView.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/Montserrat-Light.otf")); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getDimension(3)); //TODO // FIXME: 5/2/16 textView.setTextColor(getResources().getColor(R.color.search_result_category_title)); textView.setGravity(Gravity.CENTER); container.addView(textView); imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { listener.onTap(searchResult); } }); }
From source file:com.inter.trade.view.slideplayview.AbSlidingPlayView.java
/** * /*from ww w. j av a 2s.c om*/ * ???View * @param context * @throws */ public void initView(Context context) { this.context = context; layoutParamsFF = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); layoutParamsFW = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); layoutParamsWF = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); pageLineLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); //this.setBackgroundColor(Color.rgb(255, 255, 255)); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new AbInnerViewPager(context); //ViewPager,fragmentsetId()id mViewPager.setId(1985); // mPageLineLayoutParent = new LinearLayout(context); mPageLineLayoutParent.setPadding(0, 5, 0, 5); pageLineLayout = new LinearLayout(context); pageLineLayout.setPadding(15, 1, 15, 1); pageLineLayout.setVisibility(View.INVISIBLE); mPageLineLayoutParent.addView(pageLineLayout, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mPageLineLayoutParent, lp2); addView(mRelativeLayout, layoutParamsFW); displayImage = AbFileUtil.getBitmapFormSrc("image/play_display.png"); hideImage = AbFileUtil.getBitmapFormSrc("image/play_hide.png"); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }