List of usage examples for android.widget FrameLayout addView
public void addView(View child)
Adds a child view.
From source file:org.sleepydragon.rgbclient.MainFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LOG.v("onCreateView() savedInstanceState=" + savedInstanceState); final View root = inflater.inflate(R.layout.fragment_main, container, false); mColorFillView = root.findViewById(R.id.color_fill); mColorTextView = (TextView) root.findViewById(R.id.color_text); final Context context = container.getContext(); final RecyclerView commandHistoryRecyclerView = new RecyclerView(context); commandHistoryRecyclerView.setHasFixedSize(true); commandHistoryRecyclerView.setLayoutManager(new LinearLayoutManager(context)); commandHistoryRecyclerView.setAdapter(mColorState.getRecyclerViewAdapter()); final FrameLayout commandHistoryLayout = (FrameLayout) root.findViewById(R.id.command_history); commandHistoryLayout.addView(commandHistoryRecyclerView); return root;/*from w ww . j av a2s. c o m*/ }
From source file:com.gudong.appkit.ui.fragment.ColorChooseDialog.java
private View getColorItemView(final Context context, int position, boolean isSelect) { int color = mColors[position]; int widthImageCheckView = Utils.convertDensityPix(context, 24); int widthColorView = Utils.convertDensityPix(context, 56); int widthMargin = Utils.convertDensityPix(context, 4); ImageView imageView = new ImageView(context); imageView.setImageResource(R.drawable.ic_check); FrameLayout.LayoutParams ivParams = new FrameLayout.LayoutParams(widthImageCheckView, widthImageCheckView); ivParams.gravity = Gravity.CENTER;// ww w .jav a 2 s . co m imageView.setLayoutParams(ivParams); imageView.setVisibility(isSelect ? View.VISIBLE : View.INVISIBLE); FrameLayout frameLayout = new FrameLayout(context); GridLayout.LayoutParams params = new GridLayout.LayoutParams( new FrameLayout.LayoutParams(widthColorView, widthColorView)); params.setGravity(Gravity.CENTER); params.setMargins(widthMargin, widthMargin, widthMargin, widthMargin); frameLayout.setLayoutParams(params); setBackgroundSelector(frameLayout, color); frameLayout.addView(imageView); frameLayout.setOnClickListener(this); frameLayout.setTag(position); return frameLayout; }
From source file:com.jia.blossom.viewpageindicator.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);//from ww w. j av a 2 s. com 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.marshalchen.common.demoofui.pagerSlidingTabStrip.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); params.gravity = Gravity.CENTER;/*from w w w. ja va 2 s.co m*/ 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.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.view_sliding_tab_background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.codewarrior.mobiocontact.fragments.DialerFragment.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 . ja 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.background_card); v.setText("CARD 44"); fl.addView(v); return fl; }
From source file:com.codewarrior.mobiocontact.fragments.RecentFragment.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 . jav a2 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 22"); fl.addView(v); return fl; }
From source file:com.glenn.cresco.photosharingsample.fragments.PhotoCameraFragment.java
/** * Recommended "safe" way to open the camera. * * @param view// w w w.j a v a 2 s. c om * @return */ private boolean safeCameraOpenInView(View view) { boolean qOpened; releaseCameraAndPreview(); mCamera = getCameraInstance(); mCameraView = view; qOpened = (mCamera != null); if (qOpened) { mPreview = new CameraPreview(getActivity().getBaseContext(), mCamera); FrameLayout preview = (FrameLayout) view.findViewById(R.id.camera_preview); preview.addView(mPreview); mPreview.startCameraPreview(); } return qOpened; }
From source file:com.xmpp.client.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);/*www .j av a2s.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.fileback); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.kangsoo.pharmacy.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.setLayoutParams(params);/*w ww . j a v a2 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.yyb.gcquan.ui.abstractfragment.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 w w . j a va2s . 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.ic_launcher); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }