List of usage examples for android.widget FrameLayout FrameLayout
public FrameLayout(@NonNull Context context)
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);/*from w ww. j a v a 2s . c o m*/ 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); 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.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);/*from ww w. jav 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 is " + (position + 1)); fl.addView(v); return fl; }
From source file:org.dronix.android.unisannio.activity.GBNewsActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int tabnumber = -1; if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if (extras == null) { tabnumber = -1;/* ww w.ja va 2s . c o m*/ } else { tabnumber = extras.getInt("TABNUMBER"); } } Fragment myFragment = null; switch (tabnumber) { case 0: myFragment = new TabOne(); break; case 1: myFragment = new AvvisiIngFragment(); break; case 2: myFragment = new TabThree(); break; } if (tabnumber != -1) { // Create a frame layout, so we can add fragments to it. FrameLayout layout = new FrameLayout(this); layout.setId(0x1234); // Set the frame layout as the view container for this activity. setContentView(layout); // Create and add a fragment to frame layout created above. FragmentTransaction t = getSupportFragmentManager().beginTransaction(); t.add(layout.getId(), myFragment, "myFirstFragment"); t.commit(); } }
From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.ProgressFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER);//from w w w. ja va 2s . com ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); FrameLayout cframe = new FrameLayout(context); cframe.setId(INTERNAL_CONTENT_CONTAINER_ID); TextView tv = new TextView(context); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); cframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); View contentView = onCreateContentView(inflater, cframe, savedInstanceState); cframe.addView(contentView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.addView(cframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); return root; }
From source file:com.commonsware.android.arXiv.ArticleList.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FrameLayout fl = new FrameLayout(this); fl.setId(android.R.id.content);/*w w w . j a va 2 s . co m*/ setContentView(fl); Intent intent = getIntent(); name = intent.getStringExtra("keyname"); query = intent.getStringExtra("keyquery"); url = intent.getStringExtra("keyurl"); favorite = intent.getBooleanExtra("favorite", false); ActionBar ab = getSupportActionBar(); ab.setTitle(name); ab.setDisplayHomeAsUpEnabled(true); ab.setHomeButtonEnabled(true); FragmentManager fm = getSupportFragmentManager(); if (savedInstanceState == null) { articleListFragment = new ArticleListFragment(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(android.R.id.content, articleListFragment); ft.commit(); } else { Fragment f = fm.findFragmentById(android.R.id.content); if (f instanceof ArticleListFragment) articleListFragment = (ArticleListFragment) f; } }
From source file:com.geomarket.ui_logic.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FrameLayout fl = new FrameLayout(getActivity()); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); fl.setLayoutParams(params);/*from ww w.j a va 2s .co m*/ switch (position) { case 0: View offerView = inflater.inflate(R.layout.activity_fragment_offer, null); fl.addView(offerView); Fragment offerFragment = new FragmentOffer(); getFragmentManager().beginTransaction().replace(R.id.tab_offerview, offerFragment).commit(); break; case 1: View favView = inflater.inflate(R.layout.activity_fragment_fav, null); fl.addView(favView); Fragment favFragment = new FragmentFav(); getFragmentManager().beginTransaction().replace(R.id.tab_favview, favFragment).commit(); break; case 2: View GoogleMapView = inflater.inflate(R.layout.activity_fragmentgooglemap, null); fl.addView(GoogleMapView); Fragment googlefragment = new Fragmentgooglemap(); getFragmentManager().beginTransaction().replace(R.id.tab_googlemap, googlefragment).commit(); break; } return fl; }
From source file:de.escoand.readdaily.CalendarDialogFragment.java
@NonNull @Override//from w w w . j a v a 2 s . c om public Dialog onCreateDialog(final Bundle savedInstanceState) { FrameLayout v = new FrameLayout(getContext()); progress = new ProgressBar(new ContextThemeWrapper(getContext(), R.style.Progress_Circular)); cal = new MaterialCalendarView(getContext()); v.addView(progress); v.addView(cal); progress.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER)); cal.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); cal.addDecorator(new AvailableDecorator()); cal.addDecorator(new ReadDecorator()); cal.setOnDateChangedListener(this); new DataLoader().execute(); return new AlertDialog.Builder(getContext()).setTitle(R.string.navigation_calendar).setView(v) .setNegativeButton(R.string.button_cancel, null).create(); }
From source file:org.opensilk.iab.gplay.DonateActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { boolean fromConfigurationChange = false; mGraph = (ObjectGraph) getLastCustomNonConfigurationInstance(); if (mGraph == null) { if (D)/*from w w w . j a v a2 s.c om*/ Log.d(TAG, "Creating new graph"); mGraph = ((DaggerInjector) getApplication()).getObjectGraph().plus(new DonateActivityModule()); } else { fromConfigurationChange = true; } inject(this); super.onCreate(savedInstanceState); //TODO is this even needed? FrameLayout fl = new FrameLayout(this); fl.setId(R.id.iab_main); setContentView(fl); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (!fromConfigurationChange) { getSupportFragmentManager().beginTransaction().add(new PurchaseFragment(), "purchase").commit(); mIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { @Override public void onIabSetupFinished(IabResult result) { if (D) Log.d(TAG, "onSetupFinished"); Fragment f = getSupportFragmentManager().findFragmentByTag("donate"); if (f == null) { f = DonateFragment.newInstance(result.isSuccess()); } getSupportFragmentManager().beginTransaction().replace(R.id.iab_main, f, "donate").commit(); } }); } }
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);/* w w w. j ava 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.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:org.deviceconnect.android.uiapp.fragment.profile.NetworkServiceDiscoveryProfileFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { mLogger.entering(getClass().getName(), "onCreateView", new Object[] { inflater, container, savedInstanceState }); final Context context = getActivity(); FrameLayout lframe = new FrameLayout(context); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list);/*from w w w . j av a 2 s . c om*/ lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); lframe.setBackgroundColor(getResources().getColor(android.R.color.background_light)); mListView = (ListView) lframe.findViewById(android.R.id.list); mListView.setAdapter(new ArrayAdapter<SmartDevice>(getActivity(), android.R.layout.simple_list_item_1)); (new ServiceDiscoveryTask()).execute(); mLogger.exiting(getClass().getName(), "onCreateView", mListView); return lframe; }