List of usage examples for android.widget FrameLayout FrameLayout
public FrameLayout(@NonNull Context context)
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);/*from w w w. ja v a 2s. 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; }
From source file:com.lullabot.android.apps.iosched.ui.StarredActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_starred); getActivityHelper().setupActionBar(getTitle(), 0); mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabWidget = (TabWidget) findViewById(android.R.id.tabs); mTabHost.setup();// w w w . j a v a 2 s. c om // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_sessions); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final Intent intent = new Intent(Intent.ACTION_VIEW, Sessions.CONTENT_STARRED_URI); final FragmentManager fm = getSupportFragmentManager(); mSessionsFragment = (SessionsFragment) fm.findFragmentByTag("sessions"); if (mSessionsFragment == null) { mSessionsFragment = new SessionsFragment(); mSessionsFragment.setArguments(intentToFragmentArguments(intent)); fm.beginTransaction().add(R.id.fragment_sessions, mSessionsFragment, "sessions").commit(); } // Sessions content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_SESSIONS).setIndicator(buildIndicator(R.string.starred_sessions)) .setContent(R.id.fragment_sessions)); }
From source file:com.android.calculator2.Fragment.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 ww w . j a va 2 s .co m*/ 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 lframe = new FrameLayout(context); lframe.setId(INTERNAL_VIEW_CONTAINER_ID); View cv = inflateView(savedInstanceState); cv.setId(android.R.id.content); lframe.addView(cv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.addView(lframe, 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.facebook.react.testing.ReactAppTestActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(0, 0);//from w w w . j a v a 2 s. c o m // We wrap screenshot layout in another FrameLayout in order to handle custom dimensions of the // screenshot view set through {@link #setScreenshotDimensions} FrameLayout rootView = new FrameLayout(this); setContentView(rootView); mScreenshotingFrameLayout = new ScreenshotingFrameLayout(this); mScreenshotingFrameLayout.setId(ROOT_VIEW_ID); rootView.addView(mScreenshotingFrameLayout); mReactRootView = new ReactRootView(this); mScreenshotingFrameLayout.addView(mReactRootView); }
From source file:htw.bui.openreskit.meter.SeriesActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mOverlayFramelayout = new FrameLayout(this); setContentView(mOverlayFramelayout); View view = getLayoutInflater().inflate(R.layout.series_fragment, mOverlayFramelayout, false); mOverlayFramelayout.addView(view);// ww w . ja v a 2 s .c o m mContext = this; mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false); if (Utils.isTablet(this)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } ActionBar bar = getActionBar(); bar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayShowHomeEnabled(true); EnterValueFragment enterValueFrag = (EnterValueFragment) mFragMan .findFragmentById(R.id.enter_value_fragment); if (enterValueFrag != null) { enterValueFrag.getView().setVisibility(View.INVISIBLE); } }
From source file:ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTabGroup.java
public TiUIActionBarTabGroup(TabGroupProxy proxy, TiBaseActivity activity) { super(proxy, activity); activity.addOnLifecycleEventListener(this); // Setup the action bar for navigation tabs. actionBar = activity.getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(true); // Create a view to present the contents of the currently selected tab. FrameLayout tabContent = new FrameLayout(activity); tabContent.setId(android.R.id.tabcontent); TiCompositeLayout.LayoutParams params = new TiCompositeLayout.LayoutParams(); params.autoFillsHeight = true;/*from w w w . j a va2 s . co m*/ params.autoFillsWidth = true; ((ViewGroup) activity.getLayout()).addView(tabContent, params); // The tab content view will act as the "native" view for the group. // Note: since the tab bar is NOT part of the content, animations // will not transform it along with the rest of the group. setNativeView(tabContent); }
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);/*from ww w . java2s .c om*/ params.setMargins(margin, margin, margin, margin); return fl; }
From source file:com.ls.drupal8demo.ArticleActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); int contentId = 1001; ActionBar bar = this.getSupportActionBar(); bar.setDisplayShowHomeEnabled(true); bar.setDisplayHomeAsUpEnabled(true); String previewString = getIntent().getStringExtra(ARTICLE_PREVIEW_KEY); ArticlePreview preview = SharedGson.getGson().fromJson(previewString, ArticlePreview.class); InitHeaderWithPreview(preview);//from w ww . j a v a2 s. c o m View content = new FrameLayout(this); content.setId(contentId); setContentView(content); ArticleFragment articleFragment = ArticleFragment.newInstance(preview.getNid(), preview.getImage()); FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.add(contentId, articleFragment); trans.commit(); }
From source file:jp.mydns.sys1yagi.android.viewsticker.ViewSticker.java
private ViewGroup wrap(final View target, final ScrollView monitored, final ViewGroup container) { ViewGroup parent = (ViewGroup) target.getParent(); int index = parent.indexOfChild(target); parent.removeView(target);// ww w .j av a2 s .c o m final int[] dimension = new int[2]; FrameLayout stuffing = new FrameLayout(target.getContext()) { ViewTreeObserver.OnScrollChangedListener mObserver = new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { monitored.getLocationOnScreen(dimension); int offset = dimension[1]; getLocationOnScreen(dimension); int top = dimension[1] - offset; offset(target, top); if (top < 0 && indexOfChild(target) >= 0) { removeView(target); container.addView(target); } else if (top >= 0 && indexOfChild(target) < 0) { container.removeView(target); addView(target); } } }; @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec); int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec); measureChildWithMargins(target, widthMeasureSpec, 0, heightMeasureSpec, 0); setMeasuredDimension(widthSpecSize, heightSpecSize + target.getMeasuredHeight()); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); monitored.getViewTreeObserver().addOnScrollChangedListener(mObserver); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); monitored.getViewTreeObserver().removeOnScrollChangedListener(mObserver); } }; stuffing.addView(target); parent.addView(stuffing, index); return stuffing; }
From source file:com.manning.androidhacks.hack008.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContainer = new FrameLayout(this); mContainer.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mView = createNewView();/*w w w . jav a 2 s . co m*/ mContainer.addView(mView); setContentView(mContainer); }