當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。