android.support.v4.view.ViewPager.LayoutParams Java Examples
The following examples show how to use
android.support.v4.view.ViewPager.LayoutParams.
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; }
Example #3
Source File: GlidePagerFragment.java From glide-support with The Unlicense | 4 votes |
protected static ImageView createView(ViewGroup parent) { ImageView view = new ImageView(parent.getContext()); view.setId(R.id.image); view.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return view; }
Example #4
Source File: RMBTResultPagerAdapter.java From open-rmbt with Apache License 2.0 | 4 votes |
public void addResultListItem(String title, String value, LinearLayout netLayout) { final float scale = activity.getResources().getDisplayMetrics().density; final int leftRightItem = Helperfunctions.dpToPx(5, scale); final int topBottomItem = Helperfunctions.dpToPx(5, scale); final int leftRightDiv = Helperfunctions.dpToPx(0, scale); final int topBottomDiv = Helperfunctions.dpToPx(0, scale); final int heightDiv = Helperfunctions.dpToPx(1, scale); final int topBottomImg = Helperfunctions.dpToPx(1, scale); final LinearLayout netItemLayout = new LinearLayout(activity); netItemLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); netItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem); netItemLayout.setGravity(Gravity.CENTER_VERTICAL); final TextView itemTitle = new TextView(activity, null, R.style.listResultItemTitle); itemTitle.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0.4f)); itemTitle.setWidth(0); itemTitle.setGravity(Gravity.LEFT); itemTitle.setText(title); netItemLayout.addView(itemTitle); final ImageView itemClassification = new ImageView(activity); itemClassification.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 0.1f)); itemClassification.setPadding(0, topBottomImg, 0, topBottomImg); itemClassification.setImageDrawable(activity.getResources().getDrawable( R.drawable.traffic_lights_none)); netItemLayout.addView(itemClassification); final TextView itemValue = new TextView(activity, null, R.style.listResultItemValue); itemValue.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0.5f)); itemValue.setWidth(0); itemValue.setGravity(Gravity.LEFT); itemValue.setText(value); netItemLayout.addView(itemValue); netLayout.addView(netItemLayout); final View divider = new View(activity); divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv, 1)); divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv); divider.setBackgroundResource(R.drawable.bg_trans_light_10); netLayout.addView(divider); netLayout.invalidate(); }