Java Code Examples for android.widget.LinearLayout#LayoutParams
The following examples show how to use
android.widget.LinearLayout#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: MainActivity.java From journaldev with MIT License | 6 votes |
public void withSeekBar(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("With SeekBar"); final SeekBar seekBar = new SeekBar(MainActivity.this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); seekBar.setLayoutParams(lp); builder.setView(seekBar); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Toast.makeText(getApplicationContext(), "Progress is " + seekBar.getProgress(), Toast.LENGTH_SHORT).show(); } }); builder.show(); }
Example 2
Source File: UserSelectActivity.java From WeChatMomentStat-Android with GNU General Public License v3.0 | 6 votes |
protected void loadUserList() { LinearLayout userListContainer = (LinearLayout)findViewById(R.id.user_list_container); ArrayList<UserSnsInfo> userSnsList = Share.snsData.userSnsList; checkBoxList.clear(); userListContainer.removeAllViews(); for (int i=0;i<userSnsList.size();i++) { CheckBox userCheckBox = new CheckBox(this); userCheckBox.setText(userSnsList.get(i).userName + "(" + userSnsList.get(i).userId + ")" + "(" + String.format(getString(R.string.user_moment_count), userSnsList.get(i).snsList.size()) + ")"); userListContainer.addView(userCheckBox); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)userCheckBox.getLayoutParams(); layoutParams.setMargins(5, 5, 5, 5); userCheckBox.setLayoutParams(layoutParams); userCheckBox.setChecked(true); userCheckBox.setTag(userSnsList.get(i).userId); checkBoxList.add(userCheckBox); } }
Example 3
Source File: SummaryPopupWindow.java From EpisodeListView with Apache License 2.0 | 6 votes |
public SummaryPopupWindow show() { if (mPopupWindow != null) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, POPUP_TRIANGLE_WIDTH_HEIGHT); if (mLocation[0] < 0) { params.setMargins( (int) ((mWidth + POPUP_WINDOW_PADDING_LEFT_RIGHT - POPUP_TRIANGLE_WIDTH_HEIGHT) / 2 + mLocation[0]) , 0, 0, 0); } else if (mLocation[0] + mWidth + POPUP_WINDOW_PADDING_LEFT_RIGHT > mScreenWidth) { params.setMargins( (int) ((mLocation[0] + mWidth + POPUP_WINDOW_PADDING_LEFT_RIGHT - mScreenWidth) + (mWidth + POPUP_WINDOW_PADDING_LEFT_RIGHT - POPUP_TRIANGLE_WIDTH_HEIGHT) / 2) , 0, 0, 0); } else { params.gravity = Gravity.CENTER; } mTriangleImg.setLayoutParams(params); mPopupWindow.showAtLocation(mAttachView, Gravity.NO_GRAVITY, mLocation[0], mLocation[1]); } return this; }
Example 4
Source File: CommonDialogUtils.java From product-emm with Apache License 2.0 | 6 votes |
/** * * Return an Alert Dialog with two buttons and a title. * @param context - The Activity which needs this alert dialog. * @param message - The message in the alert. * @param positiveBtnLabel - The label of the positive button. * @param negetiveBtnLabel - The label of the negative button. * @param positiveClickListener- The onClickListener of the positive button. * @param negativeClickListener- The onClickListener of the negative button. * @param input - Edit text input. * @return - The generated Alert Dialog. */ public static AlertDialog.Builder getAlertDialogWithTwoButtonAndEditView(Context context, String message, String positiveBtnLabel, String negetiveBtnLabel, DialogInterface.OnClickListener positiveClickListener, DialogInterface.OnClickListener negativeClickListener, EditText input) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message).setPositiveButton(positiveBtnLabel, positiveClickListener) .setNegativeButton(negetiveBtnLabel, negativeClickListener); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); input.setLayoutParams(params); builder.setView(input); return builder; }
Example 5
Source File: CustomViewPagerActivity.java From Banner with Apache License 2.0 | 6 votes |
private void initIndicator() { for (int i = 0; i < mList.size(); i++) { ImageView imageView = new ImageView(this); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); LinearLayout.LayoutParams custom_params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); custom_params.leftMargin = 2; custom_params.rightMargin = 2; if (i == 0) { imageView.setImageResource(mIndicatorSelectedResId); } else { imageView.setImageResource(mIndicatorUnselectedResId); } indicatorImages.add(imageView); indicator.addView(imageView, custom_params); } }
Example 6
Source File: BasoProgressView.java From baso with Apache License 2.0 | 6 votes |
public void setFinishedImageLayoutParam(int width, int height) { mFinishedImageWidth = width; mFinishedImageHeight = height; int sWidth = mFinishedImageWidth; if (mFinishedImageWidth <= 0) { sWidth = LinearLayout.LayoutParams.WRAP_CONTENT; } int sHeight = mFinishedImageHeight; if (mFinishedImageHeight <= 0) { sHeight = LinearLayout.LayoutParams.WRAP_CONTENT; } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(sWidth, sHeight); params.bottomMargin = (int) (getResources().getDisplayMetrics().density * 24); mStoppedImageView.setLayoutParams(params); }
Example 7
Source File: NewSensorLocation.java From xDrip with GNU General Public License v3.0 | 5 votes |
private void AddButton(String text, int id) { RadioButton newRadioButton = new RadioButton(this); newRadioButton.setText(text); newRadioButton.setId(id); LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams( RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT); radioGroup.addView(newRadioButton); }
Example 8
Source File: PullToRefreshBase.java From SweetMusicPlayer with Apache License 2.0 | 5 votes |
private LinearLayout.LayoutParams getLoadingLayoutLayoutParams() { switch (getPullToRefreshScrollDirection()) { case HORIZONTAL: return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT); case VERTICAL: default: return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); } }
Example 9
Source File: SlidingCircleLayout.java From MyBlogDemo with Apache License 2.0 | 5 votes |
private void setPointCount(int count) { if (count == 0) { throw new IllegalStateException("填充viewpager的数量应该大于0"); } for (int i = 0; i < count; i++) { /** * 设置圆点 */ LinearLayout.LayoutParams pLayoutParams = new LinearLayout.LayoutParams(mDefaultDiameter, mDefaultDiameter); View p = new View(getContext()); p.setLayoutParams(pLayoutParams); if (point_default != null) { p.setBackgroundDrawable(point_default); } else { p.setBackgroundResource(R.drawable.point_red); } if (i > 0) { pLayoutParams.leftMargin = mleftMargin; } mLinearLayout.addView(p, i); } if (count >= 2) { mLinearLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { /** * 当布局测量好之后,来获取到点与点之间的左边距 */ @Override public void onGlobalLayout() { i = mLinearLayout.getChildAt(1).getLeft() - mLinearLayout.getChildAt(0).getLeft(); mLinearLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this); } }); } }
Example 10
Source File: OptionsPanel.java From msdkui-android with Apache License 2.0 | 5 votes |
/** * Sets a list of option items. Each {@link OptionItem} will be added to this panel. * @deprecated Please use {@link #setOptionItems(OptionItem, List)} instead. * @param parentItem the first item that should be added to this panel. * @param optionsSpecs the list of option items. */ public void setOptionsSpecs(OptionItem parentItem, final List<OptionItem> optionsSpecs) { mContentView.removeAllViews(); mContentView.addView(parentItem); for (final OptionItem item : optionsSpecs) { mContentView.addView(item); final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) item.getLayoutParams(); final int margin = (int) getResources().getDimension(R.dimen.contentMarginHuge); lp.setMargins(margin, lp.topMargin, lp.rightMargin, lp.bottomMargin); } notifyOnOptionCreated(optionsSpecs); }
Example 11
Source File: PullToRefreshBase.java From Social with Apache License 2.0 | 5 votes |
private LinearLayout.LayoutParams getLoadingLayoutLayoutParams() { switch (getPullToRefreshScrollDirection()) { case HORIZONTAL: return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT); case VERTICAL: default: return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); } }
Example 12
Source File: XListViewFooter.java From myapplication with Apache License 2.0 | 4 votes |
/** * show footer */ public void show() { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams(); lp.height = LayoutParams.WRAP_CONTENT; mContentView.setLayoutParams(lp); }
Example 13
Source File: PostFormActivity.java From Overchan-Android with GNU General Public License v3.0 | 4 votes |
@SuppressLint("InlinedApi") private LinearLayout.LayoutParams getWideLayoutParams() { return new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); }
Example 14
Source File: EditPage.java From AndroidLinkup with GNU General Public License v2.0 | 4 votes |
/** 显示平台列表 */ public void afterPlatformListGot() { String name = String.valueOf(reqData.get("platform")); int size = platformList == null ? 0 : platformList.length; views = new View[size]; final int dp_24 = dipToPx(getContext(), 24); LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_24, dp_24); final int dp_9 = dipToPx(getContext(), 9); lpItem.setMargins(0, 0, dp_9, 0); FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); lpMask.gravity = Gravity.LEFT | Gravity.TOP; int selection = 0; for (int i = 0; i < size; i++) { FrameLayout fl = new FrameLayout(getContext()); fl.setLayoutParams(lpItem); if (i >= size - 1) { fl.setLayoutParams(new LinearLayout.LayoutParams(dp_24, dp_24)); } llPlat.addView(fl); fl.setOnClickListener(this); ImageView iv = new ImageView(getContext()); iv.setScaleType(ScaleType.CENTER_INSIDE); iv.setImageBitmap(getPlatLogo(platformList[i])); iv.setLayoutParams(new FrameLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); fl.addView(iv); views[i] = new View(getContext()); views[i].setBackgroundColor(0xcfffffff); views[i].setOnClickListener(this); if (name != null && name.equals(platformList[i].getName())) { views[i].setVisibility(View.INVISIBLE); selection = i; // 编辑分享内容的统计 ShareSDK.logDemoEvent(3, platformList[i]); } views[i].setLayoutParams(lpMask); fl.addView(views[i]); } final int postSel = selection; UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() { public boolean handleMessage(Message msg) { HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent(); hsv.scrollTo(postSel * (dp_24 + dp_9), 0); return false; } }); }
Example 15
Source File: FriendListPage.java From fingerpoetry-android with Apache License 2.0 | 4 votes |
public void onCreate() { activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xfff3f3f3)); llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); float ratio = getRatio(); int titleHeight = (int) (getDesignTitleHeight() * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); View line = new View(activity); LinearLayout.LayoutParams lpline = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, (int) (ratio < 1 ? 1 : ratio)); line.setBackgroundColor(0xffdad9d9); llPage.addView(line, lpline); FrameLayout flPage = new FrameLayout(getContext()); LinearLayout.LayoutParams lpFl = new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lpFl.weight = 1; flPage.setLayoutParams(lpFl); llPage.addView(flPage); // 关注(或朋友)列表 PullToRequestView followList = new PullToRequestView(getContext()); FrameLayout.LayoutParams lpLv = new FrameLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); followList.setLayoutParams(lpLv); flPage.addView(followList); adapter = new FriendAdapter(this, followList); adapter.setPlatform(platform); adapter.setRatio(ratio); adapter.setOnItemClickListener(this); followList.setAdapter(adapter); // 请求数据 followList.performPullingDown(true); }
Example 16
Source File: DialogRootView.java From AndroidMaterialDialog with Apache License 2.0 | 4 votes |
/** * Adapts the padding of the areas, which are contained by the dialog. */ private void adaptAreaPadding() { if (areas != null) { boolean paddingTopApplied = false; Area previousArea = null; View previousView = null; int scrollViewPaddingTop = 0; int scrollViewMarginBottom = 0; Iterator<Map.Entry<Area, View>> iterator = areas.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<Area, View> entry = iterator.next(); Area area = entry.getKey(); View view = entry.getValue(); applyDialogPaddingLeft(area, view); applyDialogPaddingRight(area, view); if (!paddingTopApplied) { paddingTopApplied = applyDialogPaddingTop(area, view); } if (!iterator.hasNext()) { applyDialogPaddingBottom(area, view); } if (previousArea != null) { if (area == Area.BUTTON_BAR) { applyDialogPaddingBottom(previousArea, previousView); } Pair<Integer, Integer> pair = addViewSpacing(previousArea, previousView, area); scrollViewPaddingTop += pair.first != null ? pair.first : 0; scrollViewMarginBottom += pair.second != null ? pair.second : 0; } previousArea = area; previousView = view; } if (scrollView != null) { LinearLayout.LayoutParams layoutParams = (LayoutParams) scrollView.getLayoutParams(); layoutParams.bottomMargin = scrollViewMarginBottom; scrollView.setPadding(scrollView.getPaddingLeft(), scrollView.getPaddingTop() + scrollViewPaddingTop, scrollView.getPaddingRight(), scrollView.getPaddingBottom()); } } }
Example 17
Source File: BlockEditText.java From BlockEditText with Apache License 2.0 | 4 votes |
private ViewGroup.LayoutParams createWidthMatchParentLayoutParams() { return new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT ); }
Example 18
Source File: PagerSlidingTabStrip.java From ScrollableLayout with MIT License | 4 votes |
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true); setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); // get system attrs (android:textSize and android:textColor) TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); tabTextSize = a.getDimensionPixelSize(0, tabTextSize); tabTextColor = a.getColor(1, tabTextColor); a.recycle(); // get custom attrs a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor); dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps); a.recycle(); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); if (locale == null) { locale = getResources().getConfiguration().locale; } }
Example 19
Source File: MainActivity.java From file-downloader with Apache License 2.0 | 4 votes |
private void showMultiNewDownloadDialog() { final EditText etUrl1 = new EditText(this); etUrl1.setText("http://img13.360buyimg.com/n1/g14/M01/1B/1F/rBEhVlM03iwIAAAAAAFJnWsj5UAAAK8_gKFgkMAAUm1950" + ".jpg");// web image file,jpg etUrl1.setFocusable(true); final EditText etUrl2 = new EditText(this); etUrl2.setText("http://sqdd.myapp.com/myapp/qqteam/AndroidQQ/mobileqq_android.apk");// apk file,tencent qq etUrl2.setFocusable(true); final EditText etUrl3 = new EditText(this); etUrl3.setText("http://down.sandai.net/thunder7/Thunder_dl_7.9.41.5020.exe");// exe file,thunder etUrl3.setFocusable(true); final EditText etUrl4 = new EditText(this); etUrl4.setText("http://mp4.28mtv.com/mp41/1862-刘德华-余生一起过[68mtv.com].mp4");// mp4 file,mv etUrl4.setFocusable(true); final EditText etUrl5 = new EditText(this); etUrl5.setText("http://182.254.149.157/ftp/image/shop/product/@#_% &.apk");// apk file, with special characters etUrl5.setFocusable(true); LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); linearLayout.addView(etUrl1, params); linearLayout.addView(etUrl2, params); linearLayout.addView(etUrl3, params); linearLayout.addView(etUrl4, params); linearLayout.addView(etUrl5, params); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.main__please_input_multi_download_files)).setView(linearLayout) .setNegativeButton(getString(R.string.main__dialog_btn_cancel), null); builder.setPositiveButton(getString(R.string.main__dialog_btn_confirm), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // file urls String url1 = etUrl1.getText().toString().trim(); String url2 = etUrl2.getText().toString().trim(); String url3 = etUrl3.getText().toString().trim(); String url4 = etUrl4.getText().toString().trim(); String url5 = etUrl5.getText().toString().trim(); List<String> urls = new ArrayList<String>(); urls.add(url1); urls.add(url2); urls.add(url3); urls.add(url4); urls.add(url5); boolean isDownloadConfigurationTest = false;// TEST if (!isDownloadConfigurationTest) { FileDownloader.start(urls); } else { // TEST DownloadConfiguration DownloadConfiguration.MultiBuilder builder1 = new DownloadConfiguration.MultiBuilder(); builder1.addHeaderWithUrl(url1, "Accept", "*/*"); builder1.addHeaderWithUrl(url2, "Date", "Tue, 15 Nov 2015 08:12:31 GMT"); builder1.addHeaderWithUrl(url3, "Pragma", "no-cache"); builder1.addHeader("Pragma", "no-cache-common"); builder1.replaceHeaderWithUrl(url2, "Date", "Tue, 15 Nov 2016 08:12:31 GMT"); // builder1.configRequestMethod("GET"); builder1.configRequestMethodWithUrl(url2, "POST"); FileDownloader.start(urls, builder1.build()); } } }); builder.show(); }
Example 20
Source File: FloatingWindow.java From PerfMon-Plus with BSD 3-Clause "New" or "Revised" License | 4 votes |
void monitor_init(){ LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); line=new TextView[linen]; if(SharedPreferencesUtil.sharedPreferences.getInt(SharedPreferencesUtil.height,SharedPreferencesUtil.default_height)!=SharedPreferencesUtil.default_height) params.height=SharedPreferencesUtil.sharedPreferences.getInt(SharedPreferencesUtil.height,SharedPreferencesUtil.default_height); else params.height=(linen+1)*(int)(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20,getResources().getDisplayMetrics())*size_multiple_now); windowManager.updateViewLayout(main,params); ui_refresher=new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message message) { int i=0; if(Support.support_cpufreq&&show_cpufreq_now) { for (i = 0; i < RefreshingDateThread.cpunum; i++) { String text = "cpu" + i + " "; if (cpuonline[i] == 1) { text = text + cpufreq[i] + " Mhz"; if (Support.support_cpuload&&show_cpuload_now) text = text + Tools.format_ify_add_blank(cpufreq[i] + "") + cpuload[i] + "%"; } else { text = text +getResources().getString(R.string.offline); } line[i].setText(text); } } if(Support.support_adrenofreq&&show_gpufreq_now) { if(show_gpuload_now) line[i].setText("gpu0 " + adrenofreq + " Mhz"+Tools.format_ify_add_blank(adrenofreq+"") + adrenoload + "%"); else line[i].setText("gpu0 " + adrenofreq + " Mhz"+Tools.format_ify_add_blank(adrenofreq+"")); i++; } if (Support.support_mincpubw&&show_mincpubw_now) { line[i].setText("mincpubw " + mincpubw); i++; } if (Support.support_cpubw&&show_cpubw_now) { line[i].setText("cpubw " + cpubw); i++; } if (Support.support_gpubw&&show_gpubw_now) { line[i].setText("gpubw " + gpubw); i++; } if (Support.support_llcbw&&show_llcbw_now) { line[i].setText("llcbw " + llcbw); i++; } if (Support.support_m4m&show_m4m_now) { line[i].setText("m4m " + m4m+" Mhz"); i++; } if (Support.support_temp&&show_thermal_now) { line[i].setText(getResources().getString(R.string.temp) + maxtemp+" ℃"); i++; } if (Support.support_mem&&show_mem_now) { line[i].setText(getResources().getString(R.string.mem) + memusage+"%"); i++; } if (Support.support_current&&show_current_now) { line[i].setText(getResources().getString(R.string.current)+ current+" mA"); i++; } if (Support.support_fps&&show_fps_now) { line[i].setText("fps " + fps); i++; } return false; } }); for (int i=0;i<linen;i++){ line[i]=new TextView(this); line[i].setTextColor(getResources().getColor(R.color.white)); line[i].setLayoutParams(layoutParams); line[i].setTextSize(TypedValue.COMPLEX_UNIT_PX,line[i].getTextSize()*size_multiple_now); main.addView(line[i]); } windowManager.updateViewLayout(main,params); new RefreshingDateThread().start(); }