android.view.ViewGroup.LayoutParams Java Examples
The following examples show how to use
android.view.ViewGroup.LayoutParams.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewPagerSampleActivity.java From ZoomImageView with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* * Use full screen window and translucent action bar */ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setBackgroundDrawable(new ColorDrawable(0xFF000000)); if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); getActionBar().setBackgroundDrawable(new ColorDrawable(0x88000000)); // Note: if you use ActionBarSherlock use here getSupportActionBar() } setContentView(R.layout.view_pager); ViewPager viewPager = (ViewPager) findViewById(R.id.zoomViewPager); viewPager.setAdapter(new SamplePagerAdapter()); // Add margin between pages (optional) viewPager.setPageMargin((int) getResources().getDisplayMetrics().density * 10); }
Example #2
Source File: TextEntryElement.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * {@inheritDoc} */ @Override protected View createView(Context c) { et = new EditText(c); et.setBackgroundResource(R.drawable.oval); et.setTextColor(c.getResources() .getColorStateList(R.color.primary_text_holo_light)); et.setText(answer); et.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); if (!NumericType.NONE.equals(numericType)) { KeyListener listener = getKeyListenerForType(numericType); if (listener != null) et.setKeyListener(listener); } else { et.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | TYPE_TEXT_FLAG_NO_SUGGESTIONS); } return encapsulateQuestion(c, et); }
Example #3
Source File: MessageActivity.java From toktok-android with GNU General Public License v3.0 | 6 votes |
private void startOverLayFriend() { SlideInContactsLayout overlayContactsLayout = (SlideInContactsLayout) getLayoutInflater().inflate( R.layout.overlay_contacts, null, false); WindowManager.LayoutParams params = new WindowManager.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, PixelFormat.TRANSLUCENT ); getWindowManager().addView(overlayContactsLayout, params); TypedValue tv = new TypedValue(); int actionBarHeight = getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true) ? TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()) : 0; overlayContactsLayout.start(this, Friend.lorem, actionBarHeight); }
Example #4
Source File: LatinIME.java From Indic-Keyboard with Apache License 2.0 | 6 votes |
private void showOptionDialog(final AlertDialog dialog) { final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken(); if (windowToken == null) { return; } final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); }
Example #5
Source File: EditPage.java From POCenter with MIT License | 6 votes |
public void setActivity(Activity activity) { super.setActivity(activity); if (isDialogMode()) { System.err.println("Theme classic does not support dialog mode!"); // activity.setTheme(android.R.style.Theme_Dialog); // activity.requestWindowFeature(Window.FEATURE_NO_TITLE); // if (Build.VERSION.SDK_INT >= 11) { // try { // ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false); // } catch (Throwable e) {} // } } activity.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); }
Example #6
Source File: MoreFloatingDialog.java From letv with Apache License 2.0 | 6 votes |
public MoreFloatingDialog(Context context) { super(context, 16973840); WindowManager windowManager = (WindowManager) context.getSystemService("window"); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); this.density = displayMetrics.density; f.b(f.d, "-->(MoreFloatingDialog) : density = " + this.density); LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2); this.mContentView = new RelativeLayout(context); this.mContentView.setLayoutParams(layoutParams); this.mContentView.setBackgroundDrawable(a.a(SOURCE_FLOATING_BG, context, this.ninePatchRect)); this.mRootView = new LinearLayout(context); layoutParams = new LinearLayout.LayoutParams(-1, -2); this.mRootView.setLayoutParams(layoutParams); this.mShareItems.put(SOURCE_QQ_BG, addShareItemText(a.a(SOURCE_QQ_BG, getContext(), this.ninePatchRect), "QQ分享")); this.mShareItems.put(SOURCE_QZONE_BG, addShareItemText(a.a(SOURCE_QZONE_BG, getContext(), this.ninePatchRect), "空间分享")); this.mContentView.addView(this.mRootView, layoutParams); setContentView(this.mContentView); }
Example #7
Source File: MultiColumnListAdapter.java From multi-column-list-adapter with Apache License 2.0 | 6 votes |
/** * Create a new row view. */ @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { // create a row view LinearLayout row = new LinearLayout(context); row.setWeightSum(numColumns); V[] gridItemViewHolders = newGridItemViewHolderArray(numColumns); // inflate a grid item view for each column in the row for (int col = 0; col < numColumns; col++) { View gridItemView = newGridItemView(context, cursor, parent); LinearLayout.LayoutParams lp = newGridItemLayoutParams(col); gridItemViewHolders[col] = newGridItemViewHolder(gridItemView); row.addView(gridItemView, lp); } // save the grid item view holders in the row view holder RowViewHolder holder = new RowViewHolder(gridItemViewHolders); row.setTag(holder); return row; }
Example #8
Source File: BaseMessageDialog.java From Leanplum-Android-SDK with Apache License 2.0 | 6 votes |
private CloseButton createCloseButton(Activity context, boolean fullscreen, View parent) { CloseButton closeButton = new CloseButton(context); closeButton.setId(R.id.close_button); RelativeLayout.LayoutParams closeLayout = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); if (fullscreen) { closeLayout.addRule(RelativeLayout.ALIGN_PARENT_TOP, dialogView.getId()); closeLayout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, dialogView.getId()); closeLayout.setMargins(0, SizeUtil.dp5, SizeUtil.dp5, 0); } else { closeLayout.addRule(RelativeLayout.ALIGN_TOP, parent.getId()); closeLayout.addRule(RelativeLayout.ALIGN_RIGHT, parent.getId()); closeLayout.setMargins(0, -SizeUtil.dp7, -SizeUtil.dp7, 0); } closeButton.setLayoutParams(closeLayout); closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { cancel(); } }); return closeButton; }
Example #9
Source File: CustomSelectDialog.java From YCDialog with Apache License 2.0 | 6 votes |
/** * 当对话框启动的时候被调用 */ @Override protected void onStart() { super.onStart(); //设置弹窗的位置时在底部 Window window = getWindow(); // 设置显示动画 if (window != null) { window.setWindowAnimations(R.style.BottomDialogAnimationStyle); WindowManager.LayoutParams wl = window.getAttributes(); wl.x = 0; wl.y = mActivity.getWindowManager().getDefaultDisplay().getHeight(); // 以下这两句是为了保证按钮可以水平满屏 wl.width = LayoutParams.MATCH_PARENT; wl.height = LayoutParams.WRAP_CONTENT; // 设置显示位置 onWindowAttributesChanged(wl); } }
Example #10
Source File: MoreFloatingDialog.java From letv with Apache License 2.0 | 6 votes |
private TextView addShareItemText(Drawable drawable, String str) { if (drawable != null) { drawable.setBounds(0, 0, dip2px(SHARE_ICON_SIZE), dip2px(SHARE_ICON_SIZE)); } View textView = new TextView(getContext()); textView.setTextColor(-1); textView.setCompoundDrawables(null, drawable, null, null); textView.setTextSize(13.0f); textView.setCompoundDrawablePadding(dip2px(8.0f)); textView.setPadding(0, dip2px(19.0f), 0, dip2px(19.0f)); textView.setGravity(1); textView.setText(str); LayoutParams layoutParams = new LinearLayout.LayoutParams(0, -2); layoutParams.weight = 1.0f; layoutParams.gravity = 1; this.mRootView.addView(textView, layoutParams); addHorizontalDivider(); return textView; }
Example #11
Source File: LogViewerActivity.java From PressureNet with GNU General Public License v3.0 | 6 votes |
public void showChart(View v) { LinearLayout mainLayout = (LinearLayout) findViewById(R.id.layout_chart_fragment); try { View testChartView = findViewById(100); // TODO: ... mainLayout.removeView(testChartView); } catch (Exception e) { // e.printStackTrace(); } v.setId(100); // TODO: what's safe? // add to layout LayoutParams lparams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); v.setBackgroundColor(Color.rgb(238, 238, 238)); v.setLayoutParams(lparams); if (mainLayout == null) { // log("ERROR layout null, chart"); return; } mainLayout.addView(v); }
Example #12
Source File: PPopupDialogFragment.java From PHONK with GNU General Public License v3.0 | 6 votes |
private void calculateSize() { Window window = getDialog().getWindow(); Point size = new Point(); Display display = window.getWindowManager().getDefaultDisplay(); display.getSize(size); if (mW < 0) { mWidth = WindowManager.LayoutParams.WRAP_CONTENT; } else if (mW > 1) { mWidth = WindowManager.LayoutParams.MATCH_PARENT; } else { mWidth = (int) (size.x * mW); } if (mH < 0) { mHeight = WindowManager.LayoutParams.WRAP_CONTENT; } else if (mH > 1) { mHeight = WindowManager.LayoutParams.MATCH_PARENT; } else { mHeight = (int) (size.y * mH); } }
Example #13
Source File: GlobalStatusMenu.java From jitsi-android with Apache License 2.0 | 6 votes |
/** * On pre show */ protected void preShow() { if (mRootView == null) throw new IllegalStateException( "setContentView was not called with a view to display."); onShow(); if (mBackground == null) mWindow.setBackgroundDrawable(new BitmapDrawable()); else mWindow.setBackgroundDrawable(mBackground); mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT); mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); mWindow.setTouchable(true); mWindow.setFocusable(true); mWindow.setOutsideTouchable(true); mWindow.setContentView(mRootView); }
Example #14
Source File: MainActivity.java From KlyphMessenger with MIT License | 6 votes |
private void setPortraitMode() { SlidingPaneLayout.LayoutParams params = (SlidingPaneLayout.LayoutParams) rightContainer.getLayoutParams(); params.width = KlyphDevice.getDeviceWidth();// rightContainerWidth; // params.leftMargin = paddingLeft; params.rightMargin = 0; rightContainer.setLayoutParams(params); params = (SlidingPaneLayout.LayoutParams) leftContainer.getLayoutParams(); params.width = leftContainerWidth; params.leftMargin = 0; params.rightMargin = 0; leftContainer.setLayoutParams(params); slidingPane.requestLayout(); }
Example #15
Source File: FoundFragment.java From WeCenterMobile-Android with GNU General Public License v2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.found_fragment, container, false); cursor = (ImageView) rootView.findViewById(R.id.cursor); DisplayMetrics dm = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); int screenW = dm.widthPixels;// ��ȡ�ֱ��ʿ�� LayoutParams ps = cursor.getLayoutParams(); ps.width = screenW / 3; cursor.setLayoutParams(ps); t1 = (TextView) rootView.findViewById(R.id.text1); t2 = (TextView) rootView.findViewById(R.id.text2); t3 = (TextView) rootView.findViewById(R.id.text3); viewPager = (ViewPager) rootView.findViewById(R.id.foundpager); InitTextView(); InitImageView(); InitViewPager(); return rootView; }
Example #16
Source File: DialogActAgree.java From BigApp_Discuz_Android with Apache License 2.0 | 6 votes |
private void init(Context context) { View view = LayoutInflater.from(context).inflate( R.layout.dialog_act_agree, null); dialog = new Dialog(context, R.style.Dialog_act_agree); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(view); Window window = dialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); lp.gravity = Gravity.BOTTOM; lp.width = LayoutParams.MATCH_PARENT; window.setWindowAnimations(R.style.dialogWindowAnim); view.findViewById(R.id.ll_agree).setOnClickListener(this); view.findViewById(R.id.ll_refuse).setOnClickListener(this); }
Example #17
Source File: JazzyViewActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override public Object instantiateItem(ViewGroup container, final int position) { TextView text = new TextView(JazzyViewActivity.this); text.setGravity(Gravity.CENTER); text.setTextSize(30); text.setTextColor(Color.WHITE); text.setText("Page " + position); text.setPadding(30, 30, 30, 30); int bg = Color.rgb((int) Math.floor(Math.random()*128)+64, (int) Math.floor(Math.random()*128)+64, (int) Math.floor(Math.random()*128)+64); text.setBackgroundColor(bg); container.addView(text, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mJazzy.setObjectForPosition(text, position); return text; }
Example #18
Source File: BaseMessageDialog.java From Leanplum-Android-SDK with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") private ImageView createBackgroundImageView(Context context, boolean fullscreen) { BackgroundImageView view = new BackgroundImageView(context, fullscreen); view.setScaleType(ImageView.ScaleType.CENTER_CROP); int cornerRadius; if (!fullscreen) { cornerRadius = SizeUtil.dp20; } else { cornerRadius = 0; } view.setImageBitmap(options.getBackgroundImage()); ShapeDrawable footerBackground = new ShapeDrawable(); footerBackground.setShape(createRoundRect(cornerRadius)); footerBackground.getPaint().setColor(options.getBackgroundColor()); if (Build.VERSION.SDK_INT >= 16) { view.setBackground(footerBackground); } else { view.setBackgroundDrawable(footerBackground); } RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); view.setLayoutParams(layoutParams); return view; }
Example #19
Source File: AppRate.java From FireFiles with Apache License 2.0 | 5 votes |
private void displayViews(ViewGroup mainView) { if(null != viewGroup){ viewGroup.setVisibility(View.VISIBLE); viewGroup.addView(mainView); } else{ LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); activity.addContentView(mainView, params); } Animation fadeInAnimation = AnimationUtils.loadAnimation(activity, android.R.anim.fade_in); mainView.startAnimation(fadeInAnimation); if (onShowListener != null) onShowListener.onRateAppShowing(); }
Example #20
Source File: EditPagePort.java From HHComicViewer with Apache License 2.0 | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = R.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example #21
Source File: EditPageLand.java From fingerpoetry-android with Apache License 2.0 | 5 votes |
private void initBottom(LinearLayout llBottom, float ratio) { LinearLayout llAt = new LinearLayout(activity); llAt.setPadding(0, 0, 0, 5); llAt.setBackgroundColor(0xffffffff); int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight); llBottom.addView(llAt, lp); tvAt = new TextView(activity); tvAt.setTextColor(0xff3b3b3b); tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); tvAt.setGravity(Gravity.BOTTOM); tvAt.setText("@"); int padding = (int) (DESIGN_LEFT_PADDING * ratio); tvAt.setPadding(padding, 0, padding, 0); lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); llAt.addView(tvAt, lp); tvAt.setOnClickListener(this); if (isShowAtUserLayout(platform.getName())) { tvAt.setVisibility(View.VISIBLE); } else { tvAt.setVisibility(View.INVISIBLE); } tvTextCouter = new TextView(activity); tvTextCouter.setTextColor(0xff3b3b3b); tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT); onTextChanged(etContent.getText(), 0, 0, 0); tvTextCouter.setPadding(padding, 0, padding, 0); lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); lp.weight = 1; llAt.addView(tvTextCouter, lp); View v = new View(activity); v.setBackgroundColor(0xffcccccc); int px_1 = ratio > 1 ? ((int) ratio) : 1; lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1); llBottom.addView(v, lp); }
Example #22
Source File: EditPage.java From enjoyshop with Apache License 2.0 | 5 votes |
public void setActivity(Activity activity) { super.setActivity(activity); if (isDialogMode()) { // activity.setTheme(android.R.style.Theme_Dialog); // activity.requestWindowFeature(Window.FEATURE_NO_TITLE); // if (Build.VERSION.SDK_INT >= 11) { // try { // ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false); // } catch (Throwable e) {} // } } activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); }
Example #23
Source File: WebsiteSettingsPopup.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** Displays the WebsiteSettingsPopup. */ @CalledByNative private void show() { ScrollView scrollView = new ScrollView(mContext); scrollView.addView(mContainer); mDialog.addContentView(scrollView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); mDialog.show(); }
Example #24
Source File: OAuthManagerDialogFragment.java From react-native-oauth with MIT License | 5 votes |
private LayoutParams getFullscreenLayoutParams(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); // DisplayMetrics metrics = context.getResources().getDisplayMetrics(); Display display = wm.getDefaultDisplay(); int realWidth; int realHeight; if (Build.VERSION.SDK_INT >= 17){ //new pleasant way to get real metrics DisplayMetrics realMetrics = new DisplayMetrics(); display.getRealMetrics(realMetrics); realWidth = realMetrics.widthPixels; realHeight = realMetrics.heightPixels; } else if (Build.VERSION.SDK_INT >= 14) { //reflection for this weird in-between time try { Method mGetRawH = Display.class.getMethod("getRawHeight"); Method mGetRawW = Display.class.getMethod("getRawWidth"); realWidth = (Integer) mGetRawW.invoke(display); realHeight = (Integer) mGetRawH.invoke(display); } catch (Exception e) { //this may not be 100% accurate, but it's all we've got realWidth = display.getWidth(); realHeight = display.getHeight(); Log.e("Display Info", "Couldn't use reflection to get the real display metrics."); } } else { //This should be close, as lower API devices should not have window navigation bars realWidth = display.getWidth(); realHeight = display.getHeight(); } return new LayoutParams(realWidth, realHeight); }
Example #25
Source File: RadioSectionFragment.java From satstat with GNU General Public License v3.0 | 5 votes |
protected void showCellGsm(CellTowerGsm cellTower) { TableRow row = (TableRow) mainActivity.getLayoutInflater().inflate(R.layout.ril_list_item, null); TextView type = (TextView) row.findViewById(R.id.type); TextView mcc = (TextView) row.findViewById(R.id.mcc); TextView mnc = (TextView) row.findViewById(R.id.mnc); TextView area = (TextView) row.findViewById(R.id.area); TextView cell = (TextView) row.findViewById(R.id.cell); TextView cell2 = (TextView) row.findViewById(R.id.cell2); TextView unit = (TextView) row.findViewById(R.id.unit); TextView dbm = (TextView) row.findViewById(R.id.dbm); type.setTextColor(rilCells.getContext().getResources().getColor(getColorFromGeneration(cellTower.getGeneration()))); type.setText(rilCells.getContext().getResources().getString(R.string.smallDot)); mcc.setText(formatCellData(rilCells.getContext(), "%03d", cellTower.getMcc())); mnc.setText(formatCellData(rilCells.getContext(), "%02d", cellTower.getMnc())); area.setText(formatCellData(rilCells.getContext(), null, cellTower.getLac())); int rtcid = cellTower.getCid() / 0x10000; int cid = cellTower.getCid() % 0x10000; if ((mainActivity.prefCid) && (cellTower.getCid() != CellTower.UNKNOWN) && (cellTower.getCid() > 0x0ffff)) { cell.setText(String.format("%d-%d", rtcid, cid)); cell2.setText(formatCellData(rilCells.getContext(), null, cellTower.getCid())); } else { cell.setText(formatCellData(rilCells.getContext(), null, cellTower.getCid())); cell2.setText(String.format("%d-%d", rtcid, cid)); } cell2.setVisibility((mainActivity.prefCid2 && (cellTower.getCid() > 0x0ffff)) ? View.VISIBLE : View.GONE); unit.setText(formatCellData(rilCells.getContext(), null, cellTower.getPsc())); dbm.setText(formatCellDbm(rilCells.getContext(), null, cellTower.getDbm())); rilCells.addView(row,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
Example #26
Source File: PluginClientActivity.java From AndroidPlugin with MIT License | 5 votes |
@Override public void setContentView(View view, LayoutParams params) { if (mProxyActivity == null) { super.setContentView(view, params); } else { mProxyActivity.setContentView(view, params); } }
Example #27
Source File: ExtendedFloatingActionButtonTest.java From material-components-android with Apache License 2.0 | 5 votes |
private ExtendedFloatingActionButton createFabForTest() { ExtendedFloatingActionButton fab = new ExtendedFloatingActionButton(activity); fab.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); fab.setText("Test text"); fab.setIconResource(android.R.drawable.btn_star); fab.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); return fab; }
Example #28
Source File: PreviewPhotoActivity.java From TraceByAmap with MIT License | 5 votes |
@SuppressLint({ "NewApi", "InlinedApi" }) private void initListViews() { if (listViews == null) { listViews = new ArrayList<NetworkImageView>(); } NetworkImageView img = new NetworkImageView(this); img.setBackgroundColor(0xff000000);// 黑色 img.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); img.setScaleType(ScaleType.FIT_CENTER);// 图片填充方式 listViews.add(img);// 添加view }
Example #29
Source File: SystemWebChromeClient.java From chappiecast with Mozilla Public License 2.0 | 5 votes |
@Override /** * Ask the host application for a custom progress view to show while * a <video> is loading. * @return View The progress view. */ public View getVideoLoadingProgressView() { if (mVideoProgressView == null) { // Create a new Loading view programmatically. // create the linear layout LinearLayout layout = new LinearLayout(parentEngine.getView().getContext()); layout.setOrientation(LinearLayout.VERTICAL); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); layout.setLayoutParams(layoutParams); // the proress bar ProgressBar bar = new ProgressBar(parentEngine.getView().getContext()); LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); barLayoutParams.gravity = Gravity.CENTER; bar.setLayoutParams(barLayoutParams); layout.addView(bar); mVideoProgressView = layout; } return mVideoProgressView; }
Example #30
Source File: GosConfigCountdownActivity.java From gokit-android with MIT License | 5 votes |
private void initView() { WindowManager wm = this.getWindowManager(); int width = wm.getDefaultDisplay().getWidth(); RelativeLayout cel_layout = (RelativeLayout) findViewById(R.id.layoutparms); LayoutParams params = cel_layout.getLayoutParams(); params.height = width; params.width = width; cel_layout.setLayoutParams(params); tvTimer = (TextView) findViewById(R.id.tvTimer); rpbConfig = (RoundProgressBar) findViewById(R.id.rpbConfig); String softAPLoadingText = (String) getText(R.string.softap_loading); progressDialog.setMessage(softAPLoadingText); }