Java Code Examples for android.widget.EditText#setTextSize()
The following examples show how to use
android.widget.EditText#setTextSize() .
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: EditTextSettingsCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public EditTextSettingsCell(Context context) { super(context); textView = new EditText(context); textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); textView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setLines(1); textView.setMaxLines(1); textView.setSingleLine(true); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL); textView.setBackgroundDrawable(null); textView.setPadding(0, 0, 0, 0); textView.setInputType(textView.getInputType() |EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 0, 17, 0)); }
Example 2
Source File: Views.java From Android-Shortify with Apache License 2.0 | 6 votes |
public static $ size(int val){ try{ if(mView instanceof TextView){ TextView textView = (TextView) mView; textView.setTextSize(val); } else if(mView instanceof EditText){ EditText editText = (EditText) mView; editText.setTextSize(val); } else if(mView instanceof Button){ Button button = (Button) mView; button.setTextSize(val); } }catch (Exception e){ Log.d(TAG, e.getMessage()); } return $.getInstance(); }
Example 3
Source File: MaterialNumberPicker.java From TLint with Apache License 2.0 | 6 votes |
private void updateTextAttributes() { for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); if (child instanceof EditText) { try { Field selectorWheelPaintField = NumberPicker.class.getDeclaredField("mSelectorWheelPaint"); selectorWheelPaintField.setAccessible(true); Paint wheelPaint = ((Paint) selectorWheelPaintField.get(this)); wheelPaint.setColor(mTextColor); wheelPaint.setTextSize(mTextSize); EditText editText = ((EditText) child); editText.setTextColor(mTextColor); editText.setTextSize(pixelsToSp(getContext(), mTextSize)); invalidate(); break; } catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) { e.printStackTrace(); } } } }
Example 4
Source File: DialogUtil.java From xposed-rimet with Apache License 2.0 | 5 votes |
public static void showSearchDialog(Context context, String keyWord, final OnSearchListener listener) { int top = DisplayUtil.dip2px(context, 20f); int left = DisplayUtil.dip2px(context, 26f); FrameLayout frameLayout = new FrameLayout(context); frameLayout.setLayoutParams(LayoutUtil.newFrameLayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); frameLayout.setPadding(left, top, left, 0); int topPadding = DisplayUtil.dip2px(context, 10); int leftPadding = DisplayUtil.dip2px(context, 4); final EditText editText = new EditText(context); editText.setPadding(leftPadding, topPadding, leftPadding, topPadding); editText.setTextSize(15); editText.setText(keyWord); editText.setLayoutParams(LayoutUtil.newViewGroupParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); editText.setSingleLine(true); editText.setFilters(new InputFilter[]{ new InputFilter.LengthFilter(50)}); editText.setHint("请输入搜索的关键字"); ViewUtil.setInputType(editText, com.sky.xposed.common.Constant.InputType.TEXT); frameLayout.addView(editText); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("搜索"); builder.setView(frameLayout); builder.setPositiveButton("搜索", (dialog, which) -> { // 返回文本的内容 listener.onSearch(editText.getText().toString()); }); builder.setNegativeButton("取消", null); builder.show(); }
Example 5
Source File: OAlert.java From framework with GNU Affero General Public License v3.0 | 5 votes |
public static void inputDialog(Context context, String title, final OnUserInputListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); int margin = OResource.dimen(context, R.dimen.default_8dp); params.setMargins(margin, margin, margin, margin); LinearLayout linearLayout = new LinearLayout(context); linearLayout.setLayoutParams(params); linearLayout.setPadding(margin, margin, margin, margin); final EditText edtInput = new EditText(context); edtInput.setLayoutParams(params); edtInput.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); if (listener != null) { listener.onViewCreated(edtInput); } linearLayout.addView(edtInput); builder.setView(linearLayout); if (title != null) builder.setTitle(title); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (TextUtils.isEmpty(edtInput.getText())) { edtInput.setError("Field required"); edtInput.requestFocus(); } else { if (listener != null) { listener.onUserInputted(edtInput.getText()); } } } }); builder.setNegativeButton("Cancel", null); builder.create().show(); }
Example 6
Source File: NativeElementView.java From htmlview with Apache License 2.0 | 5 votes |
static NativeElementView createTextArea(final Context context, final Element element) { int textSize = element.getScaledPx(Style.FONT_SIZE); EditText editText = new EditText(context); editText.setSingleLine(false); editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); editText.setGravity(Gravity.TOP); // TODO: Calculate lines based on height if fixed. editText.setLines(element.getAttributeInt("rows", 2)); editText.setVerticalScrollBarEnabled(true); LayoutParams params = new LayoutParams(0, LayoutParams.WRAP_CONTENT); editText.setLayoutParams(params); NativeElementView result = new NativeElementView(context, element, false, editText); result.reset(); return result; }
Example 7
Source File: SuperDialog.java From SuperDialog with Apache License 2.0 | 5 votes |
/** * 输入框 */ private void initInputView(LinearLayout viewRoot) { inputView = new EditText(context); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(dp2px(15), dp2px(5), dp2px(15), dp2px(5)); inputView.setLayoutParams(layoutParams); inputView.setTextColor(contentTextColor); inputView.setTextSize(contentTextSize); if (inputListener != null) { inputListener.onInitEditText(inputView); } viewRoot.addView(inputView); }
Example 8
Source File: ReactTextInputShadowNode.java From react-native-GPay with MIT License | 5 votes |
@Override public long measure( YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) { // measure() should never be called before setThemedContext() EditText editText = Assertions.assertNotNull(mDummyEditText); if (mLocalData != null) { mLocalData.apply(editText); } else { editText.setTextSize( TypedValue.COMPLEX_UNIT_PX, mFontSize == UNSET ? (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : mFontSize); if (mNumberOfLines != UNSET) { editText.setLines(mNumberOfLines); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && editText.getBreakStrategy() != mTextBreakStrategy) { editText.setBreakStrategy(mTextBreakStrategy); } } // make sure the placeholder content is also being measured editText.setHint(getPlaceholder()); editText.measure( MeasureUtil.getMeasureSpec(width, widthMode), MeasureUtil.getMeasureSpec(height, heightMode)); return YogaMeasureOutput.make(editText.getMeasuredWidth(), editText.getMeasuredHeight()); }
Example 9
Source File: DialogUtil.java From xposed-rimet with Apache License 2.0 | 5 votes |
/** * 显示编辑的Dialog提示框 */ public static void showEditDialog(Context context, String title, String content, String contentHint, final OnEditListener listener) { int top = DisplayUtil.dip2px(context, 20f); int left = DisplayUtil.dip2px(context, 26f); FrameLayout frameLayout = new FrameLayout(context); frameLayout.setLayoutParams(LayoutUtil.newFrameLayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); frameLayout.setPadding(left, top, left, 0); int padding = DisplayUtil.dip2px(context, 5); final EditText editText = new EditText(context); editText.setPadding(padding, padding, padding, padding); editText.setTextSize(15); editText.setText(content); editText.setLayoutParams(LayoutUtil.newViewGroupParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); editText.setSingleLine(true); editText.setFilters(new InputFilter[]{ new InputFilter.LengthFilter(10)}); editText.setHint(contentHint); ViewUtil.setInputType(editText, com.sky.xposed.common.Constant.InputType.TEXT); frameLayout.addView(editText); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(title); builder.setView(frameLayout); builder.setPositiveButton("确定", (dialog, which) -> { // 返回文本的内容 listener.onTextChange(editText, editText.getText().toString()); }); builder.setNegativeButton("取消", null); builder.show(); }
Example 10
Source File: EditPageLand.java From Mobike with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 11
Source File: EditPageLand.java From MyHearts with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 12
Source File: EditPagePort.java From LQRWeChat with MIT License | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.VERTICAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 13
Source File: FragmentCharacteristicDetail.java From EFRConnect-android with Apache License 2.0 | 4 votes |
private void addValue(final Field field) { LinearLayout parentLayout = new LinearLayout(context); LinearLayout.LayoutParams parentParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); parentLayout.setOrientation(LinearLayout.VERTICAL); parentParams.setMargins(0, defaultMargin, 0, defaultMargin / 2); parentLayout.setLayoutParams(parentParams); LinearLayout valueLayout = addValueLayout(); TextView fieldNameView = addValueFieldName(field.getName(), valueLayout.getId()); fieldNameView.setGravity(Gravity.CENTER_VERTICAL); fieldNameView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.characteristic_list_item_value_label_text_size)); TextView fieldUnitView = addValueUnit(field); fieldUnitView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.characteristic_list_item_value_label_text_size)); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.BOTTOM; fieldUnitView.setLayoutParams(layoutParams); hidableViews.add(fieldUnitView); if (!parseProblem && field.getReference() == null) { String format = field.getFormat(); String val = readNextValue(format); if (!(format.toLowerCase().equals("utf8s") || format.toLowerCase().equals("utf16s"))) { int decimalExponentAbs = (int) abs(field.getDecimalExponent()); double divider = Math.pow(10, decimalExponentAbs); double valDouble = Double.parseDouble(val); double valTmp = valDouble / divider; val = Double.toString(valTmp); } else { writeString = true; val = val.replace("\0", ""); } if (writeable || writeableWithoutResponse) { // inline field value EditText fieldValueEdit = addValueEdit(field, val); fieldValueEdit.setGravity(Gravity.CENTER_VERTICAL); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f); params.setMargins(8, 0, 0, 0); params.gravity = Gravity.CENTER_VERTICAL; fieldValueEdit.setLayoutParams(params); fieldValueEdit.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.characteristic_list_item_value_text_size)); editTexts.add(fieldValueEdit); TextView fieldValue = (TextView) addFieldName(fieldValueEdit.getText().toString()); fieldValue.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.characteristic_list_item_value_text_size)); hidableViews.add(fieldValue); fieldValue.setTextColor(ContextCompat.getColor(getActivity(), R.color.silabs_primary_text)); valueLayout.addView(fieldValue); // dialog field value // field name View fieldName = addFieldName(field.getName()); params = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f); params.setMargins(0, 0, 8, 0); params.gravity = Gravity.CENTER_VERTICAL; fieldName.setLayoutParams(params); // container for editable field value and field name LinearLayout fieldContainer = new LinearLayout(context); fieldContainer.setOrientation(LinearLayout.HORIZONTAL); params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(0, 5, 0, 5); fieldContainer.setLayoutParams(params); fieldContainer.addView(fieldName); fieldContainer.addView(fieldValueEdit); fieldContainer.setPadding(0, FIELD_CONTAINER_PADDING_TOP, 0, FIELD_CONTAINER_PADDING_BOTTOM); writableFieldsContainer.addView(fieldContainer); } else { TextView fieldValueView = addValueText(val); fieldValueView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.characteristic_list_item_value_text_size)); hidableViews.add(fieldValueView); valueLayout.addView(fieldValueView); } updateSaveButtonState(); } valueLayout.addView(fieldUnitView); parentLayout.addView(valueLayout); parentLayout.addView(fieldNameView); valuesLayout.addView(parentLayout); }
Example 14
Source File: EditPageLand.java From HHComicViewer with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 15
Source File: EditPagePort.java From GithubApp with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.VERTICAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 16
Source File: EditPagePort.java From Social with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.VERTICAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 17
Source File: EditPageLand.java From LQRWeChat with MIT License | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 18
Source File: EditPageLand.java From GithubApp with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 19
Source File: EditPageLand.java From enjoyshop with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 20
Source File: EditPageLand.java From fingerpoetry-android with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }