当前位置: 首页>>代码示例>>Java>>正文


Java EditText.setLayoutParams方法代码示例

本文整理汇总了Java中android.widget.EditText.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setLayoutParams方法的具体用法?Java EditText.setLayoutParams怎么用?Java EditText.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.EditText的用法示例。


在下文中一共展示了EditText.setLayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setThemedContext

import android.widget.EditText; //导入方法依赖的package包/类
@Override
public void setThemedContext(ThemedReactContext themedContext) {
  super.setThemedContext(themedContext);

  // TODO #7120264: cache this stuff better
  mEditText = new EditText(getThemedContext());
  // This is needed to fix an android bug since 4.4.3 which will throw an NPE in measure,
  // setting the layoutParams fixes it: https://code.google.com/p/android/issues/detail?id=75877
  mEditText.setLayoutParams(
      new ViewGroup.LayoutParams(
          ViewGroup.LayoutParams.WRAP_CONTENT,
          ViewGroup.LayoutParams.WRAP_CONTENT));

  setDefaultPadding(Spacing.START, mEditText.getPaddingStart());
  setDefaultPadding(Spacing.TOP, mEditText.getPaddingTop());
  setDefaultPadding(Spacing.END, mEditText.getPaddingEnd());
  setDefaultPadding(Spacing.BOTTOM, mEditText.getPaddingBottom());
  mEditText.setPadding(0, 0, 0, 0);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:ReactTextInputShadowNode.java

示例2: setThemedContext

import android.widget.EditText; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public void setThemedContext(ThemedReactContext themedContext) {
  super.setThemedContext(themedContext);

  mEditText = new EditText(themedContext);
  // This is needed to fix an android bug since 4.4.3 which will throw an NPE in measure,
  // setting the layoutParams fixes it: https://code.google.com/p/android/issues/detail?id=75877
  mEditText.setLayoutParams(
      new ViewGroup.LayoutParams(
          ViewGroup.LayoutParams.WRAP_CONTENT,
          ViewGroup.LayoutParams.WRAP_CONTENT));

  setDefaultPadding(Spacing.START, mEditText.getPaddingStart());
  setDefaultPadding(Spacing.TOP, mEditText.getPaddingTop());
  setDefaultPadding(Spacing.END, mEditText.getPaddingEnd());
  setDefaultPadding(Spacing.BOTTOM, mEditText.getPaddingBottom());
  mEditText.setPadding(0, 0, 0, 0);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:RCTTextInput.java

示例3: setEditViewsName

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * 设置编辑列表VIEW
 *
 * @param names 编辑view 的name
 * @return this
 */
public BaseDialog setEditViewsName(List<String> names) {
        if (middleLayout.getChildCount() > 0) {
                middleLayout.removeAllViews();
        }
        for (String name :
                names) {
                TextView textView = new TextView(getContext());
                textView.setText(name);
                EditText editText = new EditText(getContext());
                editText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
                editText.setHint("请输入" + name);
                editText.setPadding(10, 0, 0, 0);
                editText.setHintTextColor(Color.BLUE);
                LinearLayout child = new LinearLayout(getContext());
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                child.setOrientation(LinearLayout.HORIZONTAL);
                child.setGravity(Gravity.CENTER_VERTICAL);
                child.setLayoutParams(params);
                child.addView(textView);
                child.addView(editText);
                middleLayout.addView(child);
        }
        return this;
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:31,代码来源:BaseDialog.java

示例4: onBuildContent

import android.widget.EditText; //导入方法依赖的package包/类
@Override
public View onBuildContent(QMUIDialog dialog, ScrollView parent) {
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    int padding = QMUIDisplayHelper.dp2px(mContext, 20);
    layout.setPadding(padding, padding, padding, padding);
    mEditText = new EditText(mContext);
    QMUIViewHelper.setBackgroundKeepingPadding(mEditText, QMUIResHelper.getAttrDrawable(mContext, R.attr.qmui_list_item_bg_with_border_bottom));
    mEditText.setHint("输入框");
    LinearLayout.LayoutParams editTextLP = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, QMUIDisplayHelper.dpToPx(50));
    editTextLP.bottomMargin = QMUIDisplayHelper.dp2px(getContext(), 15);
    mEditText.setLayoutParams(editTextLP);
    layout.addView(mEditText);
    TextView textView = new TextView(mContext);
    textView.setLineSpacing(QMUIDisplayHelper.dp2px(getContext(), 4), 1.0f);
    textView.setText("观察聚焦输入框后,键盘升起降下时 dialog 的高度自适应变化。\n\n" +
            "QMUI Android 的设计目的是用于辅助快速搭建一个具备基本设计还原效果的 Android 项目," +
            "同时利用自身提供的丰富控件及兼容处理,让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。" +
            "不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。");
    textView.setTextColor(ContextCompat.getColor(getContext(), R.color.app_color_description));
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    layout.addView(textView);
    return layout;
}
 
开发者ID:coopese,项目名称:qmui,代码行数:26,代码来源:QDDialogFragment.java

示例5: init

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * 初始化操作
 */
private void init() {
	ptrID1 = INVALID_POINTER_ID;
	ptrID2 = INVALID_POINTER_ID;
	mptrID1 = INVALID_POINTER_ID;
	mptrID2 = INVALID_POINTER_ID;

	list = new ArrayList<>();
	listTvParams = new ArrayList<>();
	listDistance = new ArrayList<>();

	editText = new EditText(context);
	editText.setLayoutParams(
			new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
	editText.setVisibility(GONE);
	addView(editText);
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:20,代码来源:MyRelativeLayout.java

示例6: createCommentFilterDialog

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * Creates the sub-dialogue where you can enter the substring to search for
 */
private Dialog createCommentFilterDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final EditText input = new EditText(getActivity());
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    input.setLayoutParams(layoutParams);
    builder.setTitle("Filter habit events")
            .setView(input)
            .setPositiveButton("Search",
                    new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    listener.filterResult(FilterType.SEARCH_BY_COMMENT,
                            input.getText().toString());
                }
            })
            .setNegativeButton("Cancel",
                    new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface,
                                    int i) {}
            });
    return builder.create();
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:28,代码来源:FilterDialogFragment.java

示例7: generateOneEditText

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * Takes care of styling the editText passed in the param.
 * tag is the index of the editText.
 *
 * @param styleEditText
 * @param tag
 */
private void generateOneEditText(EditText styleEditText, String tag) {
    params.setMargins(mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2);
    filters[0] = new InputFilter.LengthFilter(1);
    styleEditText.setFilters(filters);
    styleEditText.setLayoutParams(params);
    styleEditText.setGravity(Gravity.CENTER);
    styleEditText.setCursorVisible(mCursorVisible);

    if (!mCursorVisible) {
        styleEditText.setClickable(false);
        styleEditText.setHint(mHint);

        styleEditText.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                // When back space is pressed it goes to delete mode and when u click on an edit Text it should get out of the delete mode
                mDelPressed = false;
                return false;
            }
        });
    }
    styleEditText.setBackgroundResource(mPinBackground);
    styleEditText.setPadding(0, 0, 0, 0);
    styleEditText.setTag(tag);
    styleEditText.setInputType(getKeyboardInputType());
    styleEditText.addTextChangedListener(this);
    styleEditText.setOnFocusChangeListener(this);
    styleEditText.setOnKeyListener(this);
}
 
开发者ID:GoodieBag,项目名称:Pinview,代码行数:37,代码来源:Pinview.java

示例8: setSplitWidth

import android.widget.EditText; //导入方法依赖的package包/类
public void setSplitWidth(int splitWidth) {
    this.mSplitWidth = splitWidth;
    int margin = splitWidth / 2;
    params.setMargins(margin, margin, margin, margin);

    for (EditText editText : editTextList) {
        editText.setLayoutParams(params);
    }
}
 
开发者ID:GoodieBag,项目名称:Pinview,代码行数:10,代码来源:Pinview.java

示例9: setPinHeight

import android.widget.EditText; //导入方法依赖的package包/类
public void setPinHeight(int pinHeight) {
    this.mPinHeight = pinHeight;
    params.height = pinHeight;
    for (EditText editText : editTextList) {
        editText.setLayoutParams(params);
    }
}
 
开发者ID:GoodieBag,项目名称:Pinview,代码行数:8,代码来源:Pinview.java

示例10: setPinWidth

import android.widget.EditText; //导入方法依赖的package包/类
public void setPinWidth(int pinWidth) {
    this.mPinWidth = pinWidth;
    params.width = pinWidth;
    for (EditText editText : editTextList) {
        editText.setLayoutParams(params);
    }
}
 
开发者ID:GoodieBag,项目名称:Pinview,代码行数:8,代码来源:Pinview.java

示例11: showHighlightEditDialog

import android.widget.EditText; //导入方法依赖的package包/类
private void showHighlightEditDialog( final HighLight highLight ) {
    final AlertDialog.Builder editalert = new AlertDialog.Builder( context );

    editalert.setTitle(R.string.text_note);
    final EditText input = new EditText(context);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    input.setLayoutParams(lp);
    editalert.setView(input);
    input.setText( highLight.getTextNote() );

    editalert.setPositiveButton(R.string.save_note, (dialog, which) -> {
        highLight.setTextNote(input.getText().toString());
        bookView.update();
        highlightManager.saveHighLights();
    });

    editalert.setNegativeButton(android.R.string.cancel, (dialog,which) -> {} );

    editalert.setNeutralButton(R.string.clear_note, (dialog, which) -> {
        highLight.setTextNote(null);
        bookView.update();
        highlightManager.saveHighLights();
    });

    editalert.show();
}
 
开发者ID:ceji-longquan,项目名称:ceji_android,代码行数:29,代码来源:ReadingFragment.java

示例12: getMainBody

import android.widget.EditText; //导入方法依赖的package包/类
private LinearLayout getMainBody() {
	LinearLayout llMainBody = new LinearLayout(getContext());
	llMainBody.setOrientation(LinearLayout.VERTICAL);
	LinearLayout.LayoutParams lpMain = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lpMain.weight = 1;
	int dp_4 = dipToPx(getContext(), 4);
	lpMain.setMargins(dp_4, dp_4, dp_4, dp_4);
	llMainBody.setLayoutParams(lpMain);

	LinearLayout llContent = new LinearLayout(getContext());
	LinearLayout.LayoutParams lpContent = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lpContent.weight = 1;
	llMainBody.addView(llContent, lpContent);

	// 文字输入区域
	etContent = new EditText(getContext());
	etContent.setGravity(Gravity.LEFT | Gravity.TOP);
	etContent.setBackgroundDrawable(null);
	etContent.setText(String.valueOf(reqData.get("text")));
	etContent.addTextChangedListener(this);
	LinearLayout.LayoutParams lpEt = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lpEt.weight = 1;
	etContent.setLayoutParams(lpEt);
	llContent.addView(etContent);

	llContent.addView(getThumbView());
	llMainBody.addView(getBodyBottom());

	return llMainBody;
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:34,代码来源:EditPage.java

示例13: createEditText

import android.widget.EditText; //导入方法依赖的package包/类
private EditText createEditText() {
	LinearLayout.LayoutParams EditTextlayoutParams = new LinearLayout.LayoutParams(
			LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
	EditText editText = new EditText(getContext());
	editText.setLayoutParams(EditTextlayoutParams);
	editText.setHint(getString(R.string.answer, letters[inputLayout.getChildCount()]));
	editText.setInputType(InputType.TYPE_CLASS_TEXT);
	return editText;
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:10,代码来源:QuestionFragment.java

示例14: createEditText

import android.widget.EditText; //导入方法依赖的package包/类
private EditText createEditText(){
	LinearLayout.LayoutParams EditTextlayoutParams = new LinearLayout.LayoutParams(
			LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
	EditText editText = new EditText(this);
	editText.setLayoutParams(EditTextlayoutParams);
	editText.setHint(getString(R.string.editResult, letters[linearLayout.getChildCount()]));
	return editText;
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:9,代码来源:EditResultActivity.java

示例15: showAttributeDetail

import android.widget.EditText; //导入方法依赖的package包/类
private void showAttributeDetail(final String attributeType, final String attributeValue) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(attributeType);
    final EditText input = new EditText(NewPassword.this);
    input.setText(attributeValue);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);

    input.setLayoutParams(lp);
    input.requestFocus();
    builder.setView(input);

    builder.setNeutralButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            try {
                String newValue = input.getText().toString();
                if (!newValue.equals(attributeValue)) {

                    refreshItemsDisplayed();
                }
                mUserDialog.dismiss();
            } catch (Exception e) {
                Log.e(AppUtility.TAG, Log.getStackTraceString(e));
            }
        }
    });
    mUserDialog = builder.create();
    mUserDialog.show();
}
 
开发者ID:Welloculus,项目名称:MobileAppForPatient,代码行数:33,代码来源:NewPassword.java


注:本文中的android.widget.EditText.setLayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。