List of usage examples for android.widget TextView setGravity
public void setGravity(int gravity)
From source file:com.duguang.baseanimation.ui.tab.PagerTabStrip.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);//ww w. j a v a 2 s . c o m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.tab_pagertab_background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.carinsurance.pagerslidingtabstrip.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*from w w w . j av a 2 s .co m*/ final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.danielhan.neteasenews.activity.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setBackgroundResource(R.color.divider); fl.setLayoutParams(params);// www. j av a 2 s.c o m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); // v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.collcloud.frame.viewpager.main.Fragment1.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*from w w w. j a v a 2s .c o m*/ final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.tab_pagertab_background_card); v.setText("fragment1 CARD is " + (position + 1)); fl.addView(v); return fl; }
From source file:com.collcloud.frame.viewpager.main.Fragment2.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);//from w ww .j a va 2s . co m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.tab_pagertab_background_card); v.setText("fragment2 CARD is " + (position + 1)); fl.addView(v); return fl; }
From source file:com.collcloud.frame.viewpager.main.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);// w ww . j a v a 2s.c om final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.tab_pagertab_background_card); v.setText("CARD is " + (position + 1)); fl.addView(v); return fl; }
From source file:com.ageelg.android.testviewpagerwslider.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); //fl.setLayoutParams(params); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); //params.setMargins(margin, margin, margin, margin); //v.setLayoutParams(params); //v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v);/*from w w w . j a v a 2 s .co m*/ return fl; }
From source file:at.wada811.android.dialogfragments.sample.dialogfragmentcallbackprovider.DialogFragmentCallbackProviderFragment.java
@Override public DialogFragmentCallback getDialogFragmentCallback() { return new SimpleDialogFragmentCallback() { @Override/* www . j a v a 2s.c o m*/ public View getView(DialogFragmentInterface dialog) { TextView titleView = new TextView(getActivity()); titleView.setText("Use getChildFragmentManager()"); titleView.setPadding(0, 24, 0, 24); titleView.setGravity(Gravity.CENTER); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); return titleView; } }; }
From source file:com.ijiaban.tabslide.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); TuiJFragment TJ = new TuiJFragment(); fl.setLayoutParams(params);//w w w. ja v a 2 s. c o m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); getChildFragmentManager().beginTransaction().add(TJ, ARG_POSITION); fl.addView(v); return fl; }
From source file:com.example.toolbar.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/* www . j a va2 s .c o m*/ fl.setBackgroundResource(drawables[position]); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); //v.setLayoutParams(params); v.setGravity(Gravity.BOTTOM); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }