List of usage examples for android.widget FrameLayout setId
public void setId(@IdRes int id)
From source file:com.heneryh.aquanotes.ui.SearchActivity.java
/** * Build and add "sessions" tab.//from www .j av a 2s . co m */ private void setupSessionsTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_probes); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final FragmentManager fm = getSupportFragmentManager(); mSessionsFragment = (DbMaintProbesFragment) fm.findFragmentByTag("sessions"); if (mSessionsFragment == null) { mSessionsFragment = new DbMaintProbesFragment(); mSessionsFragment.setArguments(getSessionsFragmentArguments()); fm.beginTransaction().add(R.id.fragment_probes, mSessionsFragment, "sessions").commit(); } else { mSessionsFragment.reloadFromArguments(getSessionsFragmentArguments()); } // Sessions content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_SESSIONS).setIndicator(buildIndicator(R.string.db_maint_probes)) .setContent(R.id.fragment_probes)); }
From source file:com.heneryh.aquanotes.ui.SearchActivity.java
/** * Build and add "vendors" tab./*from w ww . j a v a 2s . co m*/ */ private void setupVendorsTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_controllers); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final FragmentManager fm = getSupportFragmentManager(); mVendorsFragment = (DbMaintControllersFragment) fm.findFragmentByTag("vendors"); if (mVendorsFragment == null) { mVendorsFragment = new DbMaintControllersFragment(); mVendorsFragment.setArguments(getVendorsFragmentArguments()); fm.beginTransaction().add(R.id.fragment_controllers, mVendorsFragment, "vendors").commit(); } else { mVendorsFragment.reloadFromArguments(getVendorsFragmentArguments()); } // Vendors content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_VENDORS).setIndicator(buildIndicator(R.string.db_maint_controllers)) .setContent(R.id.fragment_controllers)); }
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;/* w w w. j av a 2 s . c o 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.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);/* ww w .ja va 2 s . c o 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.hero.fm.FileExplorerTabActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); if (USE_HTCSTYLE) { requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); SetupActionBar();//from www . ja va2 s .co m } if (!USE_ACTIONBAR) getActionBar().hide(); super.onCreate(savedInstanceState); final int rootId = 1; FrameLayout viewRoot = new FrameLayout(this); viewRoot.setId(rootId); setContentView(viewRoot); mCarousel = new Carousel(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(rootId, mCarousel); ft.commit(); registerForContextMenu(viewRoot); }
From source file:com.xalops.spotifystreamer.fragments.SearchListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. *///ww w .ja v a 2s . co m @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); //QUICK Inflate from XML file //inflater.inflate(R.layout.search_list_detail, root); // ------------------------------------------------------------------ LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); 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.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ RelativeLayout rlayout = new RelativeLayout(context); EditText et = new EditText(getActivity()); et.setId(INTERNAL_SEARCH_FIELD_ID); et.setSingleLine(true); et.setInputType(InputType.TYPE_CLASS_TEXT); et.setImeOptions(EditorInfo.IME_ACTION_DONE); RelativeLayout.LayoutParams etRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); RelativeLayout.LayoutParams lframeRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); lframeRLayoutParams.addRule(RelativeLayout.BELOW, INTERNAL_SEARCH_FIELD_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); rlayout.addView(et, etRLayoutParams); rlayout.addView(lframe, lframeRLayoutParams); root.addView(rlayout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:de.vanita5.twittnuker.fragment.support.BasePullToRefreshListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a ListView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty.// www . ja v a 2s. co m * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final 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.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final RefreshNowListView lv = new RefreshNowListView(getActivity()); lv.setId(android.R.id.list); lv.setOverScrollMode(View.OVER_SCROLL_NEVER); lv.setDrawSelectorOnTop(false); lv.setOnRefreshListener(this); lv.setConfig(ThemeUtils.buildRefreshNowConfig(context)); lv.setOnTouchListener(this); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final RefreshNowProgressIndicator indicator = new RefreshNowProgressIndicator(context); indicator.setConfig(ThemeUtils.buildRefreshIndicatorConfig(context)); final int indicatorHeight = Math.round(3 * getResources().getDisplayMetrics().density); lframe.addView(indicator, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, indicatorHeight, Gravity.TOP)); lv.setRefreshIndicatorView(indicator); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:com.waz.zclient.ui.cursor.CursorToolbar.java
private void createItems() { LayoutInflater inflater = LayoutInflater.from(getContext()); int diameter = getResources().getDimensionPixelSize(R.dimen.cursor__menu_button__diameter); int rightMargin; /*// ww w .ja v a 2 s . c o m As long as 4 mainItems are shown in the toolbar, they are spread out equally in phone */ rightMargin = CursorUtils.getMarginBetweenCursorButtons(getContext()); CursorIconButton cursorIconButton; for (int i = 0; i < cursorItems.size(); i++) { final CursorMenuItem item = cursorItems.get(i); final FrameLayout buttonContainer = new FrameLayout(getContext()); buttonContainer.setId(item.resId); cursorIconButton = (CursorIconButton) inflater.inflate(R.layout.cursor__item, this, false); cursorIconButton.setText(item.glyphResId); cursorIconButton .setPressedBackgroundColor(ContextCompat.getColor(getContext(), R.color.light_graphite)); switch (item) { case CAMERA: cursorIconButtonCamera = cursorIconButton; break; case AUDIO_MESSAGE: cursorIconButtonAudio = cursorIconButton; break; } if (item == CursorMenuItem.DUMMY) { cursorIconButton.initTextColor(ContextCompat.getColor(getContext(), R.color.transparent)); cursorIconButton .setPressedBackgroundColor(ContextCompat.getColor(getContext(), R.color.transparent)); cursorIconButton.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.transparent)); } buttonContainer.setTag(item); buttonContainer.setLongClickable(true); buttonContainer.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { CursorMenuItem item = (CursorMenuItem) view.getTag(); touchedButtonContainer = buttonContainer; if (callback != null && item == CursorMenuItem.AUDIO_MESSAGE) { callback.onMotionEvent(item, motionEvent); } detector.onTouchEvent(motionEvent); return false; } }); FrameLayout.LayoutParams paramsButton = new FrameLayout.LayoutParams(diameter, diameter); paramsButton.gravity = Gravity.CENTER; buttonContainer.addView(cursorIconButton, paramsButton); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(buttonWidth, ViewGroup.LayoutParams.MATCH_PARENT); if (i < cursorItems.size() - 1) { params.rightMargin = rightMargin; } addView(buttonContainer, params); } }
From source file:org.mariotaku.twidere.fragment.support.BasePullToRefreshMultiColumnListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a ListView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty./*from w w w. j av a 2 s.c o m*/ * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final 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.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final PullToRefreshLayout plv = new PullToRefreshLayout(context); mPullToRefreshLayout = plv; final MultiColumnListView lv = createMultiColumnListView(context, inflater); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); plv.addView(lv, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); final Options.Builder builder = new Options.Builder(); builder.scrollDistance(DEFAULT_PULL_TO_REFRESH_SCROLL_DISTANCE); builder.headerTransformer(new TwidereHeaderTransformer()); if (!isDetached() && getActivity() != null) { final SetupWizard wizard = ActionBarPullToRefresh.from(getActivity()); wizard.allChildrenArePullable(); wizard.useViewDelegate(MultiColumnListView.class, new PLAAbsListViewDelegate()); wizard.listener(this); wizard.options(builder.build()); wizard.setup(mPullToRefreshLayout); } // ViewCompat.setOverScrollMode(lv, ViewCompat.OVER_SCROLL_NEVER); lframe.addView(plv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:org.sufficientlysecure.keychain.remote.ui.SelectPublicKeyFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getContext(); FrameLayout root = new FrameLayout(context); LinearLayout progressContainer = new LinearLayout(context); progressContainer.setId(INTERNAL_PROGRESS_CONTAINER_ID); progressContainer.setOrientation(LinearLayout.VERTICAL); progressContainer.setGravity(Gravity.CENTER); progressContainer.setVisibility(View.GONE); ProgressBar progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); progressContainer.addView(progressBar, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(progressContainer, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); FrameLayout listContainer = new FrameLayout(context); listContainer.setId(INTERNAL_LIST_CONTAINER_ID); TextView textView = new TextView(context); textView.setId(INTERNAL_EMPTY_VIEW_ID); textView.setGravity(Gravity.CENTER); listContainer.addView(textView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); LinearLayout innerListContainer = new LinearLayout(context); innerListContainer.setOrientation(LinearLayout.VERTICAL); mSearchView = new EditText(context); mSearchView.setId(android.R.id.input); mSearchView.setHint(R.string.menu_search); mSearchView.setCompoundDrawablesWithIntrinsicBounds( ContextCompat.getDrawable(context, R.drawable.ic_search_grey_24dp), null, null, null); innerListContainer.addView(mSearchView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); RecyclerView listView = new RecyclerView(context); listView.setId(INTERNAL_LIST_VIEW_ID); int padding = FormattingUtils.dpToPx(context, 8); listView.setPadding(padding, 0, padding, 0); listView.setClipToPadding(false);/*from w w w .j av a 2s.c o m*/ innerListContainer.addView(listView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); listContainer.addView(innerListContainer, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(listContainer, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }