Java Code Examples for android.support.v4.view.ViewPager.LayoutParams#MATCH_PARENT
The following examples show how to use
android.support.v4.view.ViewPager.LayoutParams#MATCH_PARENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GlidePagerFragment.java From glide-support with The Unlicense | 6 votes |
@Override public @Nullable View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewPager view = new ViewPager(getActivity()); // container.getContext() results in white on white text view.setId(android.R.id.list); view.setLayoutParams(new MarginLayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); PagerTitleStrip title = new PagerTabStrip(view.getContext()); ViewPager.LayoutParams params = new ViewPager.LayoutParams(); params.width = LayoutParams.MATCH_PARENT; params.height = LayoutParams.WRAP_CONTENT; params.gravity = Gravity.TOP; title.setLayoutParams(params); view.addView(title); return view; }
Example 2
Source File: MainActivity.java From ParallaxViewPagers with Apache License 2.0 | 6 votes |
@Override public Object instantiateItem(final ViewGroup container,final int position) { TextView textView=new TextView(MainActivity.this); textView.setText("item"+position); textView.setBackgroundColor(colors[position]); textView.setGravity(Gravity.CENTER); final LayoutParams params=new LayoutParams(); params.height=LayoutParams.MATCH_PARENT; params.width=LayoutParams.MATCH_PARENT; params.gravity=Gravity.CENTER; textView.setLayoutParams(params); textView.setTextColor(0xff000000); container.addView(textView); return textView; }