@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); 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); return fl; }
private void init() { if (!(getLayoutParams() instanceof ViewGroup.LayoutParams)) { LayoutParams layoutParams = new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); setLayoutParams(layoutParams); } // the default value //setPadding(dip2Px(40), dip2Px(2), dip2Px(40), dip2Px(2)); _labelViewContainerID = -1; setGravity(android.view.Gravity.CENTER); setTextColor(Color.WHITE); setTypeface(Typeface.DEFAULT_BOLD); setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); setBackgroundColor(Color.BLUE); }
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Context context = getActivity(); FrameLayout root = new FrameLayout(context); LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(1); pframe.setVisibility(8); pframe.setGravity(17); pframe.addView(new ProgressBar(context, null, 16842874), new LayoutParams(-2, -2)); root.addView(pframe, new LayoutParams(-1, -1)); FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(17); lframe.addView(tv, new LayoutParams(-1, -1)); ListView lv = new ListView(getActivity()); lv.setId(16908298); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new LayoutParams(-1, -1)); root.addView(lframe, new LayoutParams(-1, -1)); root.setLayoutParams(new LayoutParams(-1, -1)); return root; }
@Override protected MeasureOutput measure(int width, int height) { MeasureOutput measureOutput = new MeasureOutput(); if (this.mOrientation == Constants.Orientation.HORIZONTAL) { int screenW = WXViewUtils.getScreenWidth(WXEnvironment.sApplication); int weexW = WXViewUtils.getWeexWidth(getInstanceId()); measureOutput.width = width > (weexW >= screenW ? screenW : weexW) ? FrameLayout.LayoutParams.MATCH_PARENT : width; measureOutput.height = height; } else { int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication); int weexH = WXViewUtils.getWeexHeight(getInstanceId()); measureOutput.height = height > (weexH >= screenH ? screenH : weexH) ? FrameLayout.LayoutParams.MATCH_PARENT : height; measureOutput.width = width; } return measureOutput; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_web); ButterKnife.bind(this); initializeToolbar(); mWebView = new WebView(this); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mWebView.setLayoutParams(lp); mContainer.addView(mWebView, 0); if (Colorful.getThemeDelegate().isNight()) { mContainer.setAlpha(0.7f); } if (getSupportActionBar() != null) getSupportActionBar().setTitle(getIntent().getStringExtra("title")); initWebView(getIntent().getStringExtra("url")); }
/** * 设置亮度 * * @param brightness */ public void setBrightness(float brightness) { // if (lp.screenBrightness <= 0.1) { // return; // } WindowManager.LayoutParams lp = act.getWindow().getAttributes(); lp.screenBrightness = lp.screenBrightness + brightness / 255.0f; if (lp.screenBrightness > 1) { lp.screenBrightness = 1; /* * vibrator = (Vibrator) act.getSystemService("vibrator"); long[] * pattern = { 10, 200 }; // OFF/ON/OFF/ON... 关闭10秒震动200毫秒,不停切换 * vibrator.vibrate(pattern, -1); */ } else if (lp.screenBrightness < 0.2) { lp.screenBrightness = (float) 0.2; /* * vibrator = (Vibrator) act.getSystemService(act.VIBRATOR_SERVICE); * long[] pattern = { 10, 200 }; // OFF/ON/OFF/ON... * vibrator.vibrate(pattern, -1); */ } act.getWindow().setAttributes(lp); }
public BasicNativePage(Activity activity, Tab tab) { initialize(activity, tab); mActivity = activity; mTab = tab; mBackgroundColor = ApiCompatibilityUtils.getColor(activity.getResources(), R.color.default_primary_color); mThemeColor = ApiCompatibilityUtils.getColor( activity.getResources(), R.color.default_primary_color); Resources res = mActivity.getResources(); LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); layoutParams.setMargins(0, res.getDimensionPixelSize(R.dimen.tab_strip_height) + res.getDimensionPixelSize(R.dimen.toolbar_height_no_shadow), 0, 0); getView().setLayoutParams(layoutParams); }
private void hideBottomBar() { if (mBottomBarView == null) return; ((ViewGroup) mBottomBarView.getParent()).removeView(mBottomBarView); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.BOTTOM; final ViewGroup compositorView = mActivity.getCompositorViewHolder(); compositorView.addView(mBottomBarView, lp); compositorView.addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { compositorView.removeOnLayoutChangeListener(this); mBottomBarView.animate().alpha(0f).translationY(mBottomBarView.getHeight()) .setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE) .setDuration(SLIDE_ANIMATION_DURATION_MS) .withEndAction(new Runnable() { @Override public void run() { ((ViewGroup) mBottomBarView.getParent()).removeView(mBottomBarView); mBottomBarView = null; } }).start(); } }); }
private void setDate(Bitmap bitmap) { LogInfo.log("RedPacketForecastView", "setDate"); LayoutParams params = new LayoutParams(-2, -2); params.width = DensityUtil.px2dip(RedPacketSdkManager.getInstance().getApplicationContext(), 74.0f); params.height = DensityUtil.px2dip(RedPacketSdkManager.getInstance().getApplicationContext(), 74.0f); setLayoutParams(params); setImageBitmap(bitmap); setOnClickListener(new OnClickListener() { public void onClick(View v) { LogInfo.log("RedPacketForecastView", "onclick"); StatisticsUtil.statistics(11); if (RedPacketForecastView.this.mContext != null) { new RedPacketForecastDialog(RedPacketForecastView.this.mContext, RedPacketForecastView.this.mForecastBean, RedPacketForecastView.this.mDialogDisplayCallback).show(); } RedPacketForecastView.this.setVisibility(8); if (RedPacketForecastView.this.mClickCallback != null) { RedPacketForecastView.this.mClickCallback.onClick(); } } }); }
public void setRedPacketEntryLocation(boolean isLandspace) { if (this.mRedPacketEntry != null) { LayoutParams params = (LayoutParams) this.mRedPacketEntry.getLayoutParams(); if (isLandspace) { params.gravity = 83; params.leftMargin = DensityUtil.dip2px(this, 23.0f); params.width = DensityUtil.px2dip(this, 70.0f); params.height = DensityUtil.px2dip(this, 70.0f); } else { params.gravity = 85; params.rightMargin = DensityUtil.dip2px(this, 23.0f); params.width = DensityUtil.px2dip(this, 87.0f); params.height = DensityUtil.px2dip(this, 87.0f); } params.bottomMargin = DensityUtil.dip2px(this, 57.0f); this.mRedPacketEntry.setLayoutParams(params); } }
private View wrapChild(View child) { if (!this.mOutlineEnabled || (child instanceof OutlineContainer)) { return child; } View out = new OutlineContainer(getContext()); out.setLayoutParams(generateDefaultLayoutParams()); child.setLayoutParams(new LayoutParams(-1, -1)); out.addView(child); return out; }
private void layout() { int drawLocationY; int drawLocationX; int size; int width; int height; size = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); SelectionPopupImpl.this.mView.measure(size, size); height = SelectionPopupImpl.this.mView.getMeasuredHeight(); width = SelectionPopupImpl.this.mView.getMeasuredWidth(); drawLocationX = Math.min(SelectionPopupImpl.this.mScreenWidth - width, Math.max(0, (this.mSelectionLeft + ((this.mSelectionRight - this.mSelectionLeft) / 2)) - (width / 2))); drawLocationY = this.mSelectionTop - height >= 0 ? this.mSelectionTop - height : (this.mSelectionBottom + height) + this.mHandleLongerAxis >= SelectionPopupImpl.this.mScreenHeight ? this.mHandleLongerAxis > 0 ? this.mSelectionBottom - height : ((this.mSelectionBottom + this.mSelectionTop) / 2) - (height / 2) : this.mSelectionBottom + this.mHandleLongerAxis; LayoutParams layoutParams = (LayoutParams) SelectionPopupImpl.this.mView.getLayoutParams(); layoutParams.leftMargin = drawLocationX; layoutParams.topMargin = drawLocationY; layoutParams.gravity = Gravity.TOP | Gravity.LEFT; SelectionPopupImpl.this.mView.requestLayout(); }
/** * Inflates the view, which is associated with a tab, and adds it to the view hierarchy. * * @param tabItem * The tab item, which corresponds to the tab, whose associated view should be inflated, * as an instance of the class {@link TabItem}. The tab item may not be null */ private void addContentView(@NonNull final TabItem tabItem) { PhoneTabViewHolder viewHolder = (PhoneTabViewHolder) tabItem.getViewHolder(); View view = viewHolder.content; Tab tab = tabItem.getTab(); if (view == null) { ViewGroup parent = viewHolder.contentContainer; Pair<View, ?> pair = tabViewRecycler.inflate(tab, parent); view = pair.first; LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); Rect padding = getPadding(); layoutParams.setMargins(padding.left, padding.top, padding.right, padding.bottom); parent.addView(view, 0, layoutParams); viewHolder.content = view; } else { tabViewRecycler.getAdapter().onShowView(getModel().getContext(), view, tab, false); } viewHolder.previewImageView.setVisibility(View.GONE); viewHolder.previewImageView.setImageBitmap(null); viewHolder.borderView.setVisibility(View.GONE); }
@Override protected final void onShowTabView(@NonNull final View view, @NonNull final TabItem tabItem, @NonNull final Integer... params) { LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); int borderMargin = -(tabInset + tabBorderWidth); int bottomMargin = params.length > 0 && params[0] != -1 ? params[0] : borderMargin; layoutParams.leftMargin = borderMargin; layoutParams.topMargin = -(tabInset + tabTitleContainerHeight); layoutParams.rightMargin = borderMargin; layoutParams.bottomMargin = bottomMargin; view.setLayoutParams(layoutParams); adaptContentBackgroundColor(tabItem); adaptBackgroundVisibility(tabItem); if (!getModel().isSwitcherShown()) { addContentView(tabItem); } else { renderPreview(tabItem); } }
private void init() { if (!(getLayoutParams() instanceof LayoutParams)) { LayoutParams layoutParams = new LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.RIGHT | Gravity.TOP); setLayoutParams(layoutParams); } // set default font setTextColor(Color.WHITE); setTypeface(Typeface.DEFAULT_BOLD); setTextSize(TypedValue.COMPLEX_UNIT_SP, 11); setPadding(dip2Px(5), dip2Px(1), dip2Px(5), dip2Px(1)); // set default background setBackground(9, Color.parseColor("#d3321b")); setGravity(Gravity.CENTER); // default values setHideOnNull(true); setBadgeCount(0); }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; View v = convertView; if (v == null) { v = View.inflate(getContext(), R.layout.item_emoji, null); holder = new ViewHolder(); holder.icon = (EmojiconTextView) v.findViewById(R.id.emojicon_icon); holder.icon.setUseSystemDefault(this.mUseSystemDefault); v.setTag(holder); } holder = (ViewHolder) v.getTag(); holder.icon.setText(((Emojicon) getItem(position)).getEmoji()); if (position == 27) { holder.icon.setBackgroundResource(R.drawable.btn_del_nor); } else { holder.icon.setBackgroundResource(R.color.transparent); } holder.icon.setLayoutParams(new LayoutParams(-1, this.mEmojiHeight)); return v; }
public final void setEmptyView(View newEmptyView) { FrameLayout refreshableViewWrapper = getRefreshableViewWrapper(); if (newEmptyView != null) { newEmptyView.setClickable(true); ViewParent newEmptyViewParent = newEmptyView.getParent(); if (newEmptyViewParent != null && (newEmptyViewParent instanceof ViewGroup)) { ((ViewGroup) newEmptyViewParent).removeView(newEmptyView); } LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams()); if (lp != null) { refreshableViewWrapper.addView(newEmptyView, lp); } else { refreshableViewWrapper.addView(newEmptyView); } } if (this.mRefreshableView instanceof EmptyViewMethodAccessor) { ((EmptyViewMethodAccessor) this.mRefreshableView).setEmptyViewInternal(newEmptyView); } else { ((AbsListView) this.mRefreshableView).setEmptyView(newEmptyView); } this.mEmptyView = newEmptyView; }
private void addViewForTip() { for (ViewPosInfo viewPosInfo : this.mViewRects) { View view = this.mInflater.inflate(viewPosInfo.layoutId, this, false); LayoutParams lp = buildTipLayoutParams(view, viewPosInfo); if (lp != null) { lp.leftMargin = (int) viewPosInfo.marginInfo.leftMargin; lp.topMargin = (int) viewPosInfo.marginInfo.topMargin; lp.rightMargin = (int) viewPosInfo.marginInfo.rightMargin; lp.bottomMargin = (int) viewPosInfo.marginInfo.bottomMargin; if (lp.leftMargin == 0 && lp.topMargin == 0) { lp.gravity = 85; } addView(view, lp); } } }
public static void immersiveStatusBar(Window window, @FloatRange(from = 0.0d, to = 1.0d) float alpha) { if (VERSION.SDK_INT >= 19) { if (VERSION.SDK_INT >= 21) { window.clearFlags(67108864); window.addFlags(Integer.MIN_VALUE); window.setStatusBarColor(0); window.getDecorView().setSystemUiVisibility((window.getDecorView() .getSystemUiVisibility() | 1024) | 256); } else { window.addFlags(67108864); } ViewGroup decorView = (ViewGroup) window.getDecorView(); View rootView = ((ViewGroup) window.getDecorView().findViewById(16908290)).getChildAt (0); int statusBarHeight = getStatusBarHeight(window.getContext()); if (rootView != null) { LayoutParams lp = (LayoutParams) rootView.getLayoutParams(); ViewCompat.setFitsSystemWindows(rootView, true); lp.topMargin = -statusBarHeight; rootView.setLayoutParams(lp); } setTranslucentView(decorView, alpha); } }
public void setRenderView(IRenderView renderView) { if (this.mRenderView != null) { if (this.mMediaPlayer != null) { this.mMediaPlayer.setDisplay(null); } View renderUIView = this.mRenderView.getView(); this.mRenderView.removeRenderCallback(this.mSHCallback); this.mRenderView = null; removeView(renderUIView); } if (renderView != null) { this.mRenderView = renderView; renderView.setAspectRatio(this.mCurrentAspectRatio); if (this.mVideoWidth > 0 && this.mVideoHeight > 0) { renderView.setVideoSize(this.mVideoWidth, this.mVideoHeight); } if (this.mVideoSarNum > 0 && this.mVideoSarDen > 0) { renderView.setVideoSampleAspectRatio(this.mVideoSarNum, this.mVideoSarDen); } renderUIView = this.mRenderView.getView(); renderUIView.setLayoutParams(new LayoutParams(-2, -2, 17)); addView(renderUIView); this.mRenderView.addRenderCallback(this.mSHCallback); this.mRenderView.setVideoRotation(this.mVideoRotationDegree); } }
public void onItemClick(AdapterView<?> adapterView, View itemView, int position, long id) { final DragScaleImageView dragView = new DragScaleImageView(ChartletFragment.this .mContext); dragView.setImageResource(ChartletFragment.this.CHARTLET_RES_IDS[position]); LayoutParams lp = new LayoutParams(DensityUtil.dip2px(ChartletFragment.this.mContext, 108.0f), DensityUtil.dip2px(ChartletFragment.this.mContext, 108.0f)); lp.gravity = 17; dragView.setOnDeleteListener(new OnDeleteListener() { public void onDelete() { ChartletFragment.this.dragViewList.remove(dragView); } }); dragView.setOnSingleTabListener(new OnSingleTapListener() { public void onSingleTab() { Iterator it = ChartletFragment.this.dragViewList.iterator(); while (it.hasNext()) { ((DragScaleImageView) it.next()).setFocusable(false); } } }); ChartletFragment.this.dragViewList.add(dragView); ChartletFragment.this.parentLayout.addView(dragView, lp); }
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) { mStatusBarTintView = new View(context); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight()); params.gravity = Gravity.TOP; if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) { params.rightMargin = mConfig.getNavigationBarWidth(); } mStatusBarTintView.setLayoutParams(params); mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR); mStatusBarTintView.setVisibility(View.GONE); decorViewGroup.addView(mStatusBarTintView); }
public BottomProgressView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER); setLayoutParams(params); setIndicatorColor(getResources().getColor(R.color.Orange)); setIndicatorId(BallPulse); }
public void remove() { if (getParent() == null || _labelViewContainerID == -1) { return; } ViewGroup frameContainer = (ViewGroup) getParent(); assert (frameContainer.getChildCount() == 2); View target = frameContainer.getChildAt(0); ViewGroup parentContainer = (ViewGroup) frameContainer.getParent(); int groupIndex = parentContainer.indexOfChild(frameContainer); if (frameContainer.getParent() instanceof RelativeLayout) { for (int i = 0; i < parentContainer.getChildCount(); i++) { if (i == groupIndex) { continue; } View view = parentContainer.getChildAt(i); RelativeLayout.LayoutParams para = (RelativeLayout.LayoutParams) view.getLayoutParams(); for (int j = 0; j < para.getRules().length; j++) { if (para.getRules()[j] == _labelViewContainerID) { para.getRules()[j] = target.getId(); } } view.setLayoutParams(para); } } ViewGroup.LayoutParams frameLayoutParam = frameContainer.getLayoutParams(); target.setLayoutParams(frameLayoutParam); parentContainer.removeViewAt(groupIndex); frameContainer.removeView(target); frameContainer.removeView(this); parentContainer.addView(target,groupIndex); _labelViewContainerID = -1; }
public void addFace() { for (int i = 0; i < 5; i++) { ImageView iv = (ImageView) this.faceImageList.get(i); LayoutParams params = new LayoutParams(this.FACE_LENGTH, this.FACE_LENGTH); params.leftMargin = (int) ((((float) ((this.BOX_LENGTH + this.INTERVAL) * i)) + (( (float) this.BOX_LENGTH) / 2.0f)) - (((float) this.FACE_LENGTH) / 2.0f)); params.gravity = 80; iv.setLayoutParams(params); addView(iv); } }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static ViewGroup.MarginLayoutParams getToggleParams(boolean toggle, int id) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT); if(toggle){ params.addRule(RelativeLayout.ABOVE, id); } else{ params.removeRule(RelativeLayout.ABOVE); } return params; }
public void addToFrameLayout(FrameLayout frameLayout, int height) { LayoutParams var3 = new LayoutParams(bound.width(), bound.height()); var3.leftMargin = bound.left; var3.topMargin = Math.max(0, bound.top - height); var3.width = bound.width(); var3.height = bound.height(); frameLayout.addView(this, 0, var3); }
/** * 设置全屏 */ private void setFullScreen() { // 设置全屏的相关属性,获取当前的屏幕状态,然后设置全屏 act.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 全屏下的状态码:1098974464 // 窗口下的状态吗:1098973440 /************ 全屏状态下 ********************/ }
/** * 退出全屏 */ // a&=b相当于 a = a&b private void quitFullScreen() { // 声明当前屏幕状态的参数并获取 final WindowManager.LayoutParams attrs = act.getWindow().getAttributes(); attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN); act.getWindow().setAttributes(attrs); act.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); }
private void initMagicPreview() { GLSurfaceView glSurfaceView = (GLSurfaceView) findViewById(R.id.glsurfaceview_camera); FrameLayout.LayoutParams params = new LayoutParams(Constants.mScreenWidth, Constants.mScreenHeight); glSurfaceView.setLayoutParams(params); String path = "/storage/emulated/0/c.mp4"; mMagicVideoDisplay = new MagicVideoDisplay(this, glSurfaceView, path); //mMagicVideoDisplay.setFilter(MagicFilterType.CRAYON); }
/** * @param manager The fullscreen manager that should be notified of changes to this tab (if * set to null, no more updates will come from this tab). */ public void setFullscreenManager(FullscreenManager manager) { mFullscreenManager = manager; if (mFullscreenManager != null) { boolean topOffsetsInitialized = !Float.isNaN(mPreviousTopControlsOffsetY) && !Float.isNaN(mPreviousContentOffsetY); boolean bottomOffsetsInitialized = !Float.isNaN(mPreviousBottomControlsOffsetY); boolean isChromeHomeEnabled = FeatureUtilities.isChromeHomeEnabled(); // Make sure the dominant control offsets have been set. if ((!topOffsetsInitialized && !isChromeHomeEnabled) || (!bottomOffsetsInitialized && isChromeHomeEnabled)) { mFullscreenManager.setPositionsForTabToNonFullscreen(); } else { mFullscreenManager.setPositionsForTab(mPreviousTopControlsOffsetY, mPreviousBottomControlsOffsetY, mPreviousContentOffsetY); } updateFullscreenEnabledState(); } // For blimp mode, offset the blimp view by the height of browser controls. This will ensure // that the view doesn't get clipped at the bottom of the page and also the touch offsets // would work correctly. if (getBlimpContents() != null && mFullscreenManager != null) { ViewGroup blimpView = getBlimpContents().getView(); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) blimpView.getLayoutParams(); if (lp == null) { lp = new FrameLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } lp.topMargin = mFullscreenManager.getTopControlsHeight(); blimpView.setLayoutParams(lp); } }
/** * Prepare the progress bar for being attached to the window. * @param topMargin The progress bar's top margin. */ public void prepareForAttach(int topMargin) { LayoutParams curParams = new LayoutParams(getLayoutParams()); mMarginTop = topMargin; curParams.topMargin = mMarginTop; setLayoutParams(curParams); }
public void setTabs(ArrayList<ChannelNavigation> navigations, Channel mChannel) { if (!BaseTypeUtils.isListEmpty(navigations)) { int row = ((navigations.size() + 4) - 1) / 4; int height = (this.ROW_HEIGHT * row) + ((row - 1) * this.ROW_SPACING); if (this.mGridView.getLayoutParams() != null) { this.mGridView.getLayoutParams().height = height; } else { this.mGridView.setLayoutParams(new LayoutParams(UIsUtils.getScreenWidth(), height)); } } this.mChannel = mChannel; this.mAdapter.setData(navigations); }