List of usage examples for android.widget FrameLayout setLayoutParams
public void setLayoutParams(ViewGroup.LayoutParams params)
From source file:org.zywx.wbpalmstar.engine.EBrowserActivity.java
private final View initEngineUI() { mScreen = new FrameLayout(this); FrameLayout.LayoutParams screenPa = new FrameLayout.LayoutParams(Compat.FILL, Compat.FILL); mScreen.setLayoutParams(screenPa);/*from ww w . j a v a 2 s. c om*/ mEBrwMainFrame = new EBrowserMainFrame(this); FrameLayout.LayoutParams mainPagePa = new FrameLayout.LayoutParams(Compat.FILL, Compat.FILL); EUtil.viewBaseSetting(mEBrwMainFrame); mEBrwMainFrame.setLayoutParams(mainPagePa); mScreen.addView(mEBrwMainFrame); FrameLayout splash = new FrameLayout(this); splash.setClickable(true); FrameLayout.LayoutParams shelterPa = new FrameLayout.LayoutParams(Compat.FILL, Compat.FILL); splash.setLayoutParams(shelterPa); mScreen.addView(splash); /* * ImageView background = new ImageView(this); * * FrameLayout.LayoutParams backgroundPa = new * FrameLayout.LayoutParams(Compat.FILL, Compat.FILL); * background.setLayoutParams(backgroundPa); * * * * splash.addView(background); */ /* * if(0 < screenWidth && screenWidth < 480){ * foreground.setBackgroundResource(EResources.startup_fg_small); }else * if(480 <= screenWidth && screenWidth < 720){ * foreground.setBackgroundResource(EResources.startup_fg_normal); }else * if(720 <= screenWidth && screenWidth < 1080){ if(0 != * EResources.startup_fg_large){ * foreground.setBackgroundResource(EResources.startup_fg_large); }else{ * foreground.setBackgroundResource(EResources.startup_fg_normal); } * }else { if(0 != EResources.startup_fg_xlarge){ * foreground.setBackgroundResource(EResources.startup_fg_xlarge); * }else{ * foreground.setBackgroundResource(EResources.startup_fg_normal); } } */ /* * FrameLayout.LayoutParams foregroundPa = new * FrameLayout.LayoutParams(Compat.WRAP, Compat.WRAP); * foregroundPa.gravity = Gravity.CENTER; * foreground.setLayoutParams(foregroundPa); splash.addView(foreground); */ /* * ImageView mark = new ImageView(this); * mark.setBackgroundResource(EResources.mark_bg); * FrameLayout.LayoutParams markPa = new * FrameLayout.LayoutParams(Compat.WRAP, Compat.WRAP); markPa.gravity = * Gravity.BOTTOM | Gravity.RIGHT; mark.setLayoutParams(markPa); * splash.addView(mark); if(develop){ TextView worn = new * TextView(this); worn.setText("?"); * worn.setTextColor(0xffff0000); * worn.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); * FrameLayout.LayoutParams wornPa = new * FrameLayout.LayoutParams(Compat.FILL, Compat.WRAP); wornPa.gravity = * Gravity.TOP; wornPa.leftMargin = 10; wornPa.topMargin = 10; * worn.setLayoutParams(wornPa); splash.addView(worn); } */ return splash; }
From source file:com.b44t.ui.Components.PasscodeView.java
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec); int height = AndroidUtilities.displaySize.y - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight); LayoutParams layoutParams;/*from www . j a v a2 s.c o m*/ if (!AndroidUtilities.isTablet() && getContext().getResources() .getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams(); layoutParams.width = UserConfig.passcodeType == 0 ? width / 2 : width; layoutParams.height = AndroidUtilities.dp(140); layoutParams.topMargin = (height - AndroidUtilities.dp(140)) / 2; passwordFrameLayout.setLayoutParams(layoutParams); layoutParams = (LayoutParams) numbersFrameLayout.getLayoutParams(); layoutParams.height = height; layoutParams.leftMargin = width / 2; layoutParams.topMargin = height - layoutParams.height; layoutParams.width = width / 2; numbersFrameLayout.setLayoutParams(layoutParams); } else { int top = 0; int left = 0; if (AndroidUtilities.isTablet()) { if (width > AndroidUtilities.dp(498)) { left = (width - AndroidUtilities.dp(498)) / 2; width = AndroidUtilities.dp(498); } if (height > AndroidUtilities.dp(528)) { top = (height - AndroidUtilities.dp(528)) / 2; height = AndroidUtilities.dp(528); } } layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams(); layoutParams.height = height / 3; layoutParams.width = width; layoutParams.topMargin = top; layoutParams.leftMargin = left; passwordFrameLayout.setTag(top); passwordFrameLayout.setLayoutParams(layoutParams); layoutParams = (LayoutParams) numbersFrameLayout.getLayoutParams(); layoutParams.height = height / 3 * 2; layoutParams.leftMargin = left; layoutParams.topMargin = height - layoutParams.height + top; layoutParams.width = width; numbersFrameLayout.setLayoutParams(layoutParams); } int sizeBetweenNumbersX = (layoutParams.width - AndroidUtilities.dp(50) * 3) / 4; int sizeBetweenNumbersY = (layoutParams.height - AndroidUtilities.dp(50) * 4) / 5; for (int a = 0; a < 11; a++) { LayoutParams layoutParams1; int num; if (a == 0) { num = 10; } else if (a == 10) { num = 11; } else { num = a - 1; } int row = num / 3; int col = num % 3; int top; if (a < 10) { TextView textView = numberTextViews.get(a); TextView textView1 = lettersTextViews.get(a); layoutParams = (LayoutParams) textView.getLayoutParams(); layoutParams1 = (LayoutParams) textView1.getLayoutParams(); top = layoutParams1.topMargin = layoutParams.topMargin = sizeBetweenNumbersY + (sizeBetweenNumbersY + AndroidUtilities.dp(50)) * row; layoutParams1.leftMargin = layoutParams.leftMargin = sizeBetweenNumbersX + (sizeBetweenNumbersX + AndroidUtilities.dp(50)) * col; layoutParams1.topMargin += AndroidUtilities.dp(40); textView.setLayoutParams(layoutParams); textView1.setLayoutParams(layoutParams1); } else { layoutParams = (LayoutParams) eraseView.getLayoutParams(); top = layoutParams.topMargin = sizeBetweenNumbersY + (sizeBetweenNumbersY + AndroidUtilities.dp(50)) * row + AndroidUtilities.dp(8); layoutParams.leftMargin = sizeBetweenNumbersX + (sizeBetweenNumbersX + AndroidUtilities.dp(50)) * col; top -= AndroidUtilities.dp(8); eraseView.setLayoutParams(layoutParams); } FrameLayout frameLayout = numberFrameLayouts.get(a); layoutParams1 = (LayoutParams) frameLayout.getLayoutParams(); layoutParams1.topMargin = top - AndroidUtilities.dp(17); layoutParams1.leftMargin = layoutParams.leftMargin - AndroidUtilities.dp(25); frameLayout.setLayoutParams(layoutParams1); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); }
From source file:com.h6ah4i.android.example.advrecyclerview.demo_eds_vp_sec_long.MyExpandableDraggableSwipeableSectionAdapter.java
private void onBindItemGroupViewHolder(MyGroupViewHolder holder, int groupPosition) { // group item final AbstractExpandableDataProvider.GroupData item = mProvider.getGroupItem(groupPosition); // set listeners holder.itemView.setOnClickListener(mItemViewOnClickListener); // set text/*from www . j a v a 2s. c o m*/ holder.mTextView.setText(item.getText()); // set background resource (target view ID: container) final int dragState = holder.getDragStateFlags(); final int expandState = holder.getExpandStateFlags(); final int swipeState = holder.getSwipeStateFlags(); if (((dragState & Draggable.STATE_FLAG_IS_UPDATED) != 0) || ((expandState & Expandable.STATE_FLAG_IS_UPDATED) != 0) || ((swipeState & Swipeable.STATE_FLAG_IS_UPDATED) != 0)) { int bgResId; boolean isExpanded; boolean animateIndicator = ((expandState & Expandable.STATE_FLAG_HAS_EXPANDED_STATE_CHANGED) != 0); if ((dragState & Draggable.STATE_FLAG_IS_ACTIVE) != 0) { bgResId = R.drawable.bg_group_item_dragging_active_state; // need to clear drawable state here to get correct appearance of the dragging item. DrawableUtils.clearState(holder.mContainer.getForeground()); } else if ((dragState & Draggable.STATE_FLAG_DRAGGING) != 0) { bgResId = R.drawable.bg_group_item_dragging_state; } else if ((swipeState & Swipeable.STATE_FLAG_IS_ACTIVE) != 0) { //The One being swipe bgResId = R.drawable.bg_group_item_swiping_active_state; } else if ((swipeState & Swipeable.STATE_FLAG_SWIPING) != 0) { //The others... bgResId = R.drawable.bg_group_item_swiping_state; } else if ((expandState & Expandable.STATE_FLAG_IS_EXPANDED) != 0) { bgResId = R.drawable.bg_group_item_expanded_state; } else { bgResId = R.drawable.bg_group_item_normal_state; } if ((expandState & Expandable.STATE_FLAG_IS_EXPANDED) != 0) { isExpanded = true; } else { isExpanded = false; } holder.mContainer.setBackgroundResource(bgResId); /* Testing Layout change while expanding */ FrameLayout parent = ((FrameLayout) holder.mContainer.getParent()); ViewGroup.LayoutParams lp = parent.getLayoutParams(); lp.height = parent.getContext().getResources().getDimensionPixelSize(R.dimen.list_group_item_height); if (isExpanded) lp.height += 20; parent.setLayoutParams(lp); holder.mIndicator.setExpandedState(isExpanded, animateIndicator); } // set swiping properties holder.setSwipeItemHorizontalSlideAmount(item.isPinned() ? Swipeable.OUTSIDE_OF_THE_WINDOW_LEFT : 0); }
From source file:com.nadmm.airports.ActivityBase.java
public View createContentView(View view) { FrameLayout root = new FrameLayout(this); int white = ContextCompat.getColor(this, android.R.color.white); root.setBackgroundColor(white);/*from w ww . j av a2s. c o m*/ root.setDrawingCacheBackgroundColor(white); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); LinearLayout pframe = new LinearLayout(this); pframe.setId(R.id.INTERNAL_PROGRESS_CONTAINER_ID); pframe.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(this, 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)); FrameLayout lframe = new FrameLayout(this); lframe.setId(R.id.INTERNAL_FRAGMENT_CONTAINER_ID); lframe.setVisibility(View.GONE); lframe.addView(view, 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)); return root; }
From source file:info.tellmetime.DaydreamService.java
private void inflateMinutesIndicators() { FrameLayout minutesLayout = (FrameLayout) findViewById(R.id.minutes_indicators); minutesLayout.removeAllViews();/*from w w w . ja va 2 s. c o m*/ LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final boolean isLandscape = getResources() .getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; inflater.inflate(isLandscape ? R.layout.minutes_land : R.layout.minutes_portrait, minutesLayout); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, isLandscape ? FrameLayout.LayoutParams.MATCH_PARENT : FrameLayout.LayoutParams.WRAP_CONTENT); if (!isLandscape) { layoutParams.addRule(RelativeLayout.BELOW, R.id.clock); layoutParams.topMargin = (int) -TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mMinutesSize / 3, getResources().getDisplayMetrics()); } minutesLayout.setLayoutParams(layoutParams); Typeface mTypefaceBold = Typeface.createFromAsset(getAssets(), "Roboto-BoldCondensed.ttf"); ViewGroup minutesDots = (ViewGroup) findViewById(R.id.minutes_dots); for (int i = 0; i < minutesDots.getChildCount(); i++) { TextView m = (TextView) minutesDots.getChildAt(i); m.setTypeface(mTypefaceBold); m.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mMinutesSize); m.setTextColor(mBacklightColor); m.setShadowLayer(mShorterEdge / 200 * mDensity, 0, 0, mBacklightColor); } }
From source file:com.taobao.weex.ui.component.list.BasicListComponent.java
@NonNull private ListBaseViewHolder createVHForFakeComponent(int viewType) { FrameLayout view = new FrameLayout(getContext()); view.setBackgroundColor(Color.WHITE); view.setLayoutParams(new FrameLayout.LayoutParams(0, 0)); return new ListBaseViewHolder(view, viewType); }
From source file:com.taobao.weex.ui.component.list.BasicListComponent.java
private ListBaseViewHolder createVHForRefreshComponent(int viewType) { FrameLayout view = new FrameLayout(getContext()); view.setBackgroundColor(Color.WHITE); view.setLayoutParams(new FrameLayout.LayoutParams(1, 1)); view.setVisibility(View.GONE); return new ListBaseViewHolder(view, viewType); }
From source file:com.ndn.menurandom.ImageDownloader.java
private void makeFrameLayout(ImageView imageView) { boolean isExist = false; ViewGroup vg = (ViewGroup) imageView.getParent(); if (vg instanceof FrameLayout) { FrameLayout frameLayout = (FrameLayout) vg; String tag = (String) frameLayout.getTag(); if (tag != null && tag.equals("fl_imagedownloader")) { isExist = true;/*from www . j av a 2 s.c om*/ } } if (!isExist) { int childCount = vg.getChildCount(); int index = 0; while (index < childCount) { if (imageView == vg.getChildAt(index)) { break; } index++; } vg.removeViewAt(index); FrameLayout frameLayout = new FrameLayout(vg.getContext().getApplicationContext()); frameLayout.setTag("fl_imagedownloader"); ViewGroup.LayoutParams lpImageView = (ViewGroup.LayoutParams) imageView.getLayoutParams(); frameLayout.setLayoutParams(lpImageView); imageView.setLayoutParams(new LayoutParams(lpImageView.width, lpImageView.height)); frameLayout.setPadding(imageView.getPaddingLeft(), imageView.getPaddingTop(), imageView.getPaddingRight(), imageView.getPaddingBottom()); imageView.setPadding(0, 0, 0, 0); frameLayout.addView(imageView); vg.addView(frameLayout, index); ProgressBar progressBar = new ProgressBar(frameLayout.getContext()); progressBar.setTag("pb_imagedownloader"); int leftRightPadding = (imageView.getLayoutParams().width - 50) / 2; int topBottomPadding = (imageView.getLayoutParams().height - 50) / 2; progressBar.setPadding(leftRightPadding, topBottomPadding, leftRightPadding, topBottomPadding); frameLayout.addView(progressBar); } }
From source file:org.floens.chan.ui.activity.BoardActivity.java
private void updatePaneState() { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int width = metrics.widthPixels; FrameLayout left = (FrameLayout) findViewById(R.id.left_pane); FrameLayout right = (FrameLayout) findViewById(R.id.right_pane); LayoutParams leftParams = left.getLayoutParams(); LayoutParams rightParams = right.getLayoutParams(); // Content view dp's: // Nexus 4 is 384 x 640 dp // Nexus 7 is 600 x 960 dp // Nexus 10 is 800 x 1280 dp if (width < Utils.dp(800)) { if (width < Utils.dp(400)) { leftParams.width = width - Utils.dp(30); } else {/*from w w w . j av a 2s . com*/ leftParams.width = width - Utils.dp(150); } rightParams.width = width; } else { leftParams.width = Utils.dp(300); rightParams.width = width - Utils.dp(300); } left.setLayoutParams(leftParams); right.setLayoutParams(rightParams); threadPane.requestLayout(); left.requestLayout(); right.requestLayout(); }
From source file:com.aboveware.abovegame.expandable.ExpandableListFragment.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 ww w . ja v a2s. c om*/ * <p/> * <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 * AbsListFragment. In particular, this is currently the only way to have the * built-in indeterminant progress state be shown. */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FrameLayout root = new FrameLayout(getActivity()); FrameLayout lframe = new FrameLayout(getActivity()); lframe.setId(INTERNAL_LIST_CONTAINER_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)); ExpandableListView lv = new ExpandableListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, 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)); ListView.LayoutParams lp = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); root.setLayoutParams(lp); return root; }