List of usage examples for android.widget FrameLayout setLayoutParams
public void setLayoutParams(ViewGroup.LayoutParams params)
From source file:com.commnsense.proximity.fragments.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); fl.setBackgroundColor(0xffa9a9a9);//from w ww. j ava2s . 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.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.eric.quora.fragment.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); fl.setBackgroundResource(mipmaps[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);/* w w w.j av a2 s .c om*/ v.setLayoutParams(params); v.setGravity(Gravity.BOTTOM); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:org.ganjp.jone.common.WhiteCardFragment.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);//w w w.j av a 2s . co m v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("No Record " + (position + 1)); fl.addView(v); return fl; }
From source file:feipai.qiangdan.my.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, 40, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params);// www . j av a2 s.co m v.setGravity(Gravity.CENTER); // v.setBackgroundResource(R.drawable.ic_launcher); // v.setText("CARD " + (position + 1)); v.setText(" "); v.setTextSize(20); v.setTextColor(getActivity().getResources().getColor(R.color.address_title_color)); // Drawable drawable = getActivity().getDrawable(R.drawable.icon_no_order); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon_no_order); BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmap); //TextViewdrawableleft v.setCompoundDrawablesWithIntrinsicBounds(null, bitmapDrawable, null, null); fl.addView(v); return fl; }
From source file:com.hellofyc.base.app.activity.SingleFragmentActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FrameLayout layout = new FrameLayout(this); layout.setId(R.id.fragment_container); layout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); setContentView(layout);/*from w ww .java2 s.com*/ init(); setActivityContent(); }
From source file:com.kai.uGuide.ui.fragment.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()); ////from w ww . j a va 2 s .com // 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); LinearLayout pagerlayout = new LinearLayout(getActivity()); pagerlayout.setOrientation(LinearLayout.HORIZONTAL); pagerlayout.setId(300 + position); if (page == 0) adapter = AdapterTransitionFragment.newInstance(position); else adapter = ResultAdapterTransitionFragment.newInstance(position); getFragmentManager().beginTransaction().add(pagerlayout.getId(), adapter, "someTag" + position).commit(); fl.addView(pagerlayout); return fl; }
From source file:com.pendtium.base.fragments.BaseFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params); params.setMargins(margin, margin, margin, margin); return fl;// www. j a va 2 s . c o m }
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); 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);// w ww. j a v a 2 s. c om 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.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); 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);// w w w.jav a 2 s .co m 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.l4digital.fastscroll.FastScrollRecyclerView.java
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); mFastScroller.attachRecyclerView(this); final ViewParent parent = getParent(); if (parent instanceof ViewGroup) { final ViewGroup viewGroup = (ViewGroup) parent; if ((viewGroup instanceof CoordinatorLayout) || (viewGroup instanceof FrameLayout) || (viewGroup instanceof RelativeLayout)) { if (mFastScroller.getParent() == null) { viewGroup.addView(mFastScroller); mFastScroller.setLayoutParams(viewGroup); }//from w ww.ja va 2s .c om } else { if (viewGroup instanceof SwipeRefreshLayout) { mFastScroller.swipeRefreshLayout = (SwipeRefreshLayout) viewGroup; } final int index = viewGroup.indexOfChild(this); viewGroup.removeView(this); final FrameLayout fr = new FrameLayout(getContext()); fr.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); fr.addView(this); fr.addView(mFastScroller); mFastScroller.setLayoutParams(fr); viewGroup.addView(fr, index); } } }