List of usage examples for android.widget FrameLayout FrameLayout
public FrameLayout(@NonNull Context context)
From source file:com.tang.FragmentTabHost.java
private void ensureHierarchy(Context context) { // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TabWidget tw = new TabWidget(context); // /*from ww w . j a v a2 s.co m*/ tw.setShowDividers(TabWidget.SHOW_DIVIDER_NONE); tw.setId(android.R.id.tabs); tw.setOrientation(TabWidget.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1)); } }
From source file:com.ai.eve.lenovo.widget.FragmentTabHost.java
private void ensureHierarchy(Context context) { // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs);/*ww w .j a v a 2 s .co m*/ tw.setOrientation(TabWidget.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, 0, 1)); } }
From source file:com.mci.firstidol.view.ActionSheet.java
@SuppressWarnings("deprecation") private View createView() { FrameLayout parent = new FrameLayout(getActivity()); parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg = new View(getActivity()); mBg.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mBg.setBackgroundColor(Color.argb(136, 0, 0, 0)); mBg.setId(ActionSheet.BG_VIEW_ID);/*from w ww .j av a 2 s .com*/ mBg.setOnClickListener(this); mPanel = new LinearLayout(getActivity()); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.BOTTOM; mPanel.setLayoutParams(params); mPanel.setOrientation(LinearLayout.VERTICAL); TextView titleView = new TextView(getActivity()); titleView.setText(TextUtils.isEmpty(getTitle()) ? "" : getTitle()); titleView.setGravity(Gravity.CENTER); titleView.setTextColor(Color.GRAY); titleView.setBackgroundDrawable(mAttrs.actionSheetTitleBackground); mPanel.addView(titleView); parent.addView(mBg); parent.addView(mPanel); return parent; }
From source file:cn.bproject.neteasynews.widget.FragmentTabHost.java
private void ensureHierarchy(Context context) { // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs);/*from ww w. j ava 2 s . c om*/ tw.setOrientation(TabWidget.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1)); } }
From source file:com.google.android.apps.dashclock.configuration.ConfigureAppearanceFragment.java
private void configureStylePager(final ViewPager pager, final PagerPositionStrip positionStrip, final String[] styleNames, final String styleComponent, final int gravity, final String preference) { String currentStyleName = mCurrentStyleNames.get(preference); final LayoutInflater inflater = getActivity().getLayoutInflater(); pager.setAdapter(new PagerAdapter() { @Override/*w ww .ja va2 s . com*/ public int getCount() { return styleNames.length; } @Override public boolean isViewFromObject(View view, Object o) { return view == o; } @Override public Object instantiateItem(ViewGroup container, int position) { FrameLayout wrapper = new FrameLayout(getActivity()); ViewPager.LayoutParams wrapperLp = new ViewPager.LayoutParams(); wrapper.setLayoutParams(wrapperLp); String styleName = styleNames[position]; if (styleName.contains("analog")) { styleName += "_white"; } View v = inflater.inflate( AppearanceConfig.getLayoutByStyleName(getActivity(), styleComponent, styleName), container, false); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.gravity = gravity; v.setLayoutParams(lp); wrapper.addView(v); container.addView(wrapper); return wrapper; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } }); pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { mCurrentStyleNames.put(preference, styleNames[position]); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { positionStrip.setPosition(position + positionOffset); } }); positionStrip.setPageCount(styleNames.length); pager.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: showPositionStrips(true, -1); break; case MotionEvent.ACTION_UP: showPositionStrips(false, AUTO_HIDE_DELAY_MILLIS); break; } return false; } }); for (int i = 0; i < styleNames.length; i++) { if (currentStyleName.equals(styleNames[i])) { pager.setCurrentItem(i); positionStrip.setPosition(i); break; } } }
From source file:com.example.almin.widget.MyFragmentTabHost.java
private void ensureHierarchy(Context context) { // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs);//www . jav a2 s . co m tw.setOrientation(TabWidget.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1)); } }
From source file:cn.thinkjoy.startup.widget.FragmentTabHost.java
private void ensureHierarchy(Context context) { // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs);//from www. j av a 2 s . c o m tw.setOrientation(LinearLayout.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1)); } }
From source file:com.ustc.dystu.dandelion.fragment.BaseFragmentTabHost.java
private void initFragmentTabHost(Context context, AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes(attrs, new int[] { android.R.attr.inflatedId }, 0, 0); mContainerId = a.getResourceId(0, 0); a.recycle();/*ww w . j ava2 s. c o m*/ super.setOnTabChangedListener(this); // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs); tw.setOrientation(TabWidget.HORIZONTAL); tw.setDividerDrawable(null);//?ab? ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, 0, 1)); } }
From source file:org.telegram.ui.Components.ShareAlert.java
public ShareAlert(final Context context, MessageObject messageObject, final String text, boolean publicChannel, final String copyLink) { super(context, true); shadowDrawable = context.getResources().getDrawable(R.drawable.sheet_shadow); linkToCopy = copyLink;/*from w w w . j av a 2 s. c o m*/ sendingMessageObject = messageObject; searchAdapter = new ShareSearchAdapter(context); isPublicChannel = publicChannel; sendingText = text; if (publicChannel) { loadingLink = true; TLRPC.TL_channels_exportMessageLink req = new TLRPC.TL_channels_exportMessageLink(); req.id = messageObject.getId(); req.channel = MessagesController.getInputChannel(messageObject.messageOwner.to_id.channel_id); ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { @Override public void run(final TLObject response, TLRPC.TL_error error) { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { if (response != null) { exportedMessageLink = (TLRPC.TL_exportedMessageLink) response; if (copyLinkOnEnd) { copyLink(context); } } loadingLink = false; } }); } }); } containerView = new FrameLayout(context) { private boolean ignoreLayout = false; @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN && scrollOffsetY != 0 && ev.getY() < scrollOffsetY) { dismiss(); return true; } return super.onInterceptTouchEvent(ev); } @Override public boolean onTouchEvent(MotionEvent e) { return !isDismissed() && super.onTouchEvent(e); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int height = MeasureSpec.getSize(heightMeasureSpec); if (Build.VERSION.SDK_INT >= 21) { height -= AndroidUtilities.statusBarHeight; } int size = Math.max(searchAdapter.getItemCount(), listAdapter.getItemCount()); int contentSize = AndroidUtilities.dp(48) + Math.max(3, (int) Math.ceil(size / 4.0f)) * AndroidUtilities.dp(100) + backgroundPaddingTop; int padding = contentSize < height ? 0 : height - (height / 5 * 3) + AndroidUtilities.dp(8); if (gridView.getPaddingTop() != padding) { ignoreLayout = true; gridView.setPadding(0, padding, 0, AndroidUtilities.dp(8)); ignoreLayout = false; } super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(Math.min(contentSize, height), MeasureSpec.EXACTLY)); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); updateLayout(); } @Override public void requestLayout() { if (ignoreLayout) { return; } super.requestLayout(); } @Override protected void onDraw(Canvas canvas) { shadowDrawable.setBounds(0, scrollOffsetY - backgroundPaddingTop, getMeasuredWidth(), getMeasuredHeight()); shadowDrawable.draw(canvas); } }; containerView.setWillNotDraw(false); containerView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, 0); frameLayout = new FrameLayout(context); frameLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.background)); frameLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); doneButton = new LinearLayout(context); doneButton.setOrientation(LinearLayout.HORIZONTAL); doneButton.setBackgroundDrawable( Theme.createBarSelectorDrawable(Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false)); doneButton.setPadding(AndroidUtilities.dp(21), 0, AndroidUtilities.dp(21), 0); frameLayout.addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT)); doneButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (selectedDialogs.isEmpty() && (isPublicChannel || linkToCopy != null)) { if (linkToCopy == null && loadingLink) { copyLinkOnEnd = true; Toast.makeText(ShareAlert.this.getContext(), LocaleController.getString("Loading", R.string.Loading), Toast.LENGTH_SHORT).show(); } else { copyLink(ShareAlert.this.getContext()); } dismiss(); } else { if (sendingMessageObject != null) { ArrayList<MessageObject> arrayList = new ArrayList<>(); arrayList.add(sendingMessageObject); for (HashMap.Entry<Long, TLRPC.TL_dialog> entry : selectedDialogs.entrySet()) { SendMessagesHelper.getInstance().sendMessage(arrayList, entry.getKey()); } } else if (sendingText != null) { for (HashMap.Entry<Long, TLRPC.TL_dialog> entry : selectedDialogs.entrySet()) { SendMessagesHelper.getInstance().sendMessage(sendingText, entry.getKey(), null, null, true, null, null, null); } } dismiss(); } } }); doneButtonBadgeTextView = new TextView(context); doneButtonBadgeTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); doneButtonBadgeTextView.setTextColor(Theme.SHARE_SHEET_BADGE_TEXT_COLOR); doneButtonBadgeTextView.setGravity(Gravity.CENTER); doneButtonBadgeTextView.setBackgroundResource(R.drawable.bluecounter); doneButtonBadgeTextView.setMinWidth(AndroidUtilities.dp(23)); doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), AndroidUtilities.dp(1)); doneButton.addView(doneButtonBadgeTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 23, Gravity.CENTER_VERTICAL, 0, 0, 10, 0)); doneButtonTextView = new TextView(context); doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); doneButtonTextView.setGravity(Gravity.CENTER); doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8)); doneButtonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL)); ImageView imageView = new ImageView(context); imageView.setImageResource(R.drawable.search_share); imageView.setScaleType(ImageView.ScaleType.CENTER); imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0); imageView.getDrawable().setTint(Theme.SHARE_SHEET_EDIT_PLACEHOLDER_TEXT_COLOR); frameLayout.addView(imageView, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.CENTER_VERTICAL)); nameTextView = new EditText(context); nameTextView.setHint(LocaleController.getString("ShareSendTo", R.string.ShareSendTo)); nameTextView.setMaxLines(1); nameTextView.setSingleLine(true); nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); nameTextView.setBackgroundDrawable(null); nameTextView.setHintTextColor(Theme.SHARE_SHEET_EDIT_PLACEHOLDER_TEXT_COLOR); nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); nameTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); AndroidUtilities.clearCursorDrawable(nameTextView); nameTextView.setTextColor(Theme.SHARE_SHEET_EDIT_TEXT_COLOR); frameLayout.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 48, 2, 96, 0)); nameTextView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { String text = nameTextView.getText().toString(); if (text.length() != 0) { if (gridView.getAdapter() != searchAdapter) { topBeforeSwitch = getCurrentTop(); gridView.setAdapter(searchAdapter); searchAdapter.notifyDataSetChanged(); } if (searchEmptyView != null) { searchEmptyView.setText(LocaleController.getString("NoResult", R.string.NoResult)); } } else { if (gridView.getAdapter() != listAdapter) { int top = getCurrentTop(); searchEmptyView.setText(LocaleController.getString("NoChats", R.string.NoChats)); gridView.setAdapter(listAdapter); listAdapter.notifyDataSetChanged(); if (top > 0) { layoutManager.scrollToPositionWithOffset(0, -top); } } } if (searchAdapter != null) { searchAdapter.searchDialogs(text); } } }); gridView = new RecyclerListView(context); gridView.setTag(13); gridView.setPadding(0, 0, 0, AndroidUtilities.dp(8)); gridView.setClipToPadding(false); gridView.setLayoutManager(layoutManager = new GridLayoutManager(getContext(), 4)); gridView.setHorizontalScrollBarEnabled(false); gridView.setVerticalScrollBarEnabled(false); gridView.addItemDecoration(new RecyclerView.ItemDecoration() { @Override public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { Holder holder = (Holder) parent.getChildViewHolder(view); if (holder != null) { int pos = holder.getAdapterPosition(); outRect.left = pos % 4 == 0 ? 0 : AndroidUtilities.dp(4); outRect.right = pos % 4 == 3 ? 0 : AndroidUtilities.dp(4); } else { outRect.left = AndroidUtilities.dp(4); outRect.right = AndroidUtilities.dp(4); } } }); containerView.addView(gridView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 48, 0, 0)); gridView.setAdapter(listAdapter = new ShareDialogsAdapter(context)); gridView.setGlowColor(0xfff5f6f7); gridView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() { @Override public void onItemClick(View view, int position) { if (position < 0) { return; } TLRPC.TL_dialog dialog; if (gridView.getAdapter() == listAdapter) { dialog = listAdapter.getItem(position); } else { dialog = searchAdapter.getItem(position); } if (dialog == null) { return; } ShareDialogCell cell = (ShareDialogCell) view; if (selectedDialogs.containsKey(dialog.id)) { selectedDialogs.remove(dialog.id); cell.setChecked(false, true); } else { selectedDialogs.put(dialog.id, dialog); cell.setChecked(true, true); } updateSelectedCount(); } }); gridView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { updateLayout(); } }); searchEmptyView = new EmptyTextProgressView(context); searchEmptyView.setShowAtCenter(true); searchEmptyView.showTextView(); searchEmptyView.setText(LocaleController.getString("NoChats", R.string.NoChats)); gridView.setEmptyView(searchEmptyView); containerView.addView(searchEmptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 48, 0, 0)); containerView.addView(frameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.TOP)); shadow = new View(context); shadow.setBackgroundResource(R.drawable.header_shadow); containerView.addView(shadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3, Gravity.TOP | Gravity.LEFT, 0, 48, 0, 0)); updateSelectedCount(); if (!DialogsActivity.dialogsLoaded) { MessagesController.getInstance().loadDialogs(0, 100, true); ContactsController.getInstance().checkInviteText(); DialogsActivity.dialogsLoaded = true; } if (listAdapter.dialogs.isEmpty()) { NotificationCenter.getInstance().addObserver(this, NotificationCenter.dialogsNeedReload); } }
From source file:com.summer.framework.ui.widget.FragmentTabHost.java
private void ensureHierarchy(Context context) { // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs);/* ww w . ja va 2s. c o m*/ tw.setOrientation(LinearLayout.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0, 1)); } }