當前位置: 首頁>>代碼示例>>Java>>正文


Java EditText.setId方法代碼示例

本文整理匯總了Java中android.widget.EditText.setId方法的典型用法代碼示例。如果您正苦於以下問題:Java EditText.setId方法的具體用法?Java EditText.setId怎麽用?Java EditText.setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.EditText的用法示例。


在下文中一共展示了EditText.setId方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: EditTextDialogBuilder

import android.widget.EditText; //導入方法依賴的package包/類
public EditTextDialogBuilder(Context context) {
    super(context);
    mEditText = new EditText(mContext);
    mEditText.setHintTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_gray_3));
    mEditText.setTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_black));
    mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_content_message_text_size));
    mEditText.setFocusable(true);
    mEditText.setFocusableInTouchMode(true);
    mEditText.setImeOptions(EditorInfo.IME_ACTION_GO);
    mEditText.setGravity(Gravity.CENTER_VERTICAL);
    mEditText.setId(R.id.qmui_dialog_edit_input);

    mRightImageView = new ImageView(mContext);
    mRightImageView.setId(R.id.qmui_dialog_edit_right_icon);
    mRightImageView.setVisibility(View.GONE);
}
 
開發者ID:coopese,項目名稱:qmui,代碼行數:17,代碼來源:QMUIDialog.java

示例2: getInput

import android.widget.EditText; //導入方法依賴的package包/類
public static void getInput(Context context, String title, DialogInterface.OnClickListener onOkListener)
{
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(title);

    final EditText input = new EditText(context);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    input.setId(R.id.text1);
    builder.setView(input);

    builder.setPositiveButton("OK", onOkListener);

    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });

    builder.show();
}
 
開發者ID:fekracomputers,項目名稱:MuslimMateAndroid,代碼行數:22,代碼來源:Utility.java

示例3: addEdit

import android.widget.EditText; //導入方法依賴的package包/類
/**
 * Adds the new edit to the list with id, text and hint
 **/
public DialogBuilder addEdit(int id, String text, String hint) {
    // inflate row using default layout
    LayoutInflater inflater = LayoutInflater.from(context);
    View itemView = inflater.inflate(R.layout.row_edit_dialog, null);
    // if there are some rows above
    if (listLayout.getChildCount() > 0) {
        // show top border
        View borderView = itemView.findViewById(R.id.item_top_border);
        if (borderView != null) {
            borderView.setVisibility(View.VISIBLE);
        }
    }
    // setup edit
    EditText editText = (EditText) itemView.findViewById(R.id.edit_text);
    editText.setText(text);
    editText.setSelection(editText.getText().length());
    editText.setHint(hint);
    editText.setId(id);

    return addItem(itemView);
}
 
開發者ID:kaliturin,項目名稱:BlackList,代碼行數:25,代碼來源:DialogBuilder.java

示例4: saveAsDialog

import android.widget.EditText; //導入方法依賴的package包/類
private void saveAsDialog(int title, int message, String path,
                          DialogInterface.OnClickListener listener)
{
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(title);
    builder.setMessage(message);

    // Add the buttons
    builder.setPositiveButton(R.string.save, listener);
    builder.setNegativeButton(R.string.cancel, listener);

    // Create edit text
    Context context = builder.getContext();
    EditText text = new EditText(context);
    text.setId(TEXT);
    text.setText(path);

    // Create the AlertDialog
    AlertDialog dialog = builder.create();
    dialog.setView(text, 30, 0, 30, 0);
    dialog.show();
}
 
開發者ID:billthefarmer,項目名稱:editor,代碼行數:23,代碼來源:Editor.java

示例5: onCreateView

import android.widget.EditText; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View V = inflater.inflate(R.layout.fragment_edit, container, false);

    CardView cardView = (CardView) V.findViewById(R.id.EditMatrixCard);

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
    String string = sharedPreferences.getString("ELEVATE_AMOUNT", "4");
    String string2 = sharedPreferences.getString("CARD_CHANGE_KEY", "#bdbdbd");

    cardView.setCardElevation(Integer.parseInt(string));
    cardView.setCardBackgroundColor(Color.parseColor(string2));

    CardView.LayoutParams params1 = new CardView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    int index = getArguments().getInt("INDEX");
    Matrix m = ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(index);

    GridLayout gridLayout = new GridLayout(getContext());
    gridLayout.setRowCount(m.GetRow());
    gridLayout.setColumnCount(m.GetCol());
    for (int i = 0; i < m.GetRow(); i++) {
        for (int j = 0; j < m.GetCol(); j++) {
            EditText editText = new EditText(getContext());
            editText.setId(i * 10 + j);
            editText.setGravity(Gravity.CENTER);
            if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("DECIMAL_USE", true)) {
                editText.setInputType(InputType.TYPE_CLASS_NUMBER
                        | InputType.TYPE_NUMBER_FLAG_SIGNED);
            } else {
                editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
                        | InputType.TYPE_NUMBER_FLAG_SIGNED);
            }
            editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(getLength())});
            if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("SMART_FIT_KEY", false)) {
                editText.setWidth(ConvertTopx(62));
                editText.setTextSize(SizeReturner(3, 3, PreferenceManager.getDefaultSharedPreferences(getContext()).
                        getBoolean("EXTRA_SMALL_FONT", false)));
            } else {
                editText.setWidth(ConvertTopx(CalculatedWidth(m.GetCol())));
                editText.setTextSize(SizeReturner(m.GetRow(), m.GetCol(),
                        PreferenceManager.getDefaultSharedPreferences(getContext()).
                                getBoolean("EXTRA_SMALL_FONT", false)));
            }
            editText.setText(SafeSubString(GetText(m.GetElementof(i, j)), getLength()));
            editText.setSingleLine();
            GridLayout.Spec Row = GridLayout.spec(i, 1);
            GridLayout.Spec Col = GridLayout.spec(j, 1);
            GridLayout.LayoutParams params = new GridLayout.LayoutParams(Row, Col);
            gridLayout.addView(editText, params);
        }
    }
    gridLayout.setLayoutParams(params1);
    cardView.addView(gridLayout);
    RootView = V;
    return V;
}
 
開發者ID:coder3101,項目名稱:Matrix-Calculator-for-Android,代碼行數:60,代碼來源:EditFragment.java

示例6: run

import android.widget.EditText; //導入方法依賴的package包/類
@Override
public void run() {
    pageContent = cr.return_url();
    String all_valid_profiles = "";
    String all_contents = "";
    try {
        if(pageContent.isEmpty()) {
            t.setVisibility(View.VISIBLE);
            t.setText("اتصال به اینترنت لازم است.");
        }
        else {
            t.setVisibility(View.INVISIBLE);
            Document doc = Jsoup.parse(pageContent);
            doc.select("blockquote").remove();
            doc.select("p.conl").remove();
            doc.select("div.postfootleft").remove();
            doc.select("div.postsignature.postmsg").remove();
            doc.select("div.pagepost").remove();
            doc.getElementById("feedlinks").remove();
            doc.getElementById("poweredby").remove();
            Elements profiles = doc.select("dt>strong");
            for(Element valid_ones : profiles) {
                String extracted = valid_ones.attr("href");
                all_valid_profiles += (valid_ones.text() + "`");
            }
            valid_profiles = all_valid_profiles.split("`");
            Elements contents = doc.select("p");
            for(Element content : contents) {
                String extracted_content = content.text();
                all_contents += (extracted_content + "`");
            }
            valid_contents = all_contents.split("`");
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            lp.bottomMargin = 10;
            lp.topMargin = 10;
            LinearLayout.LayoutParams lptv=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            lptv.bottomMargin = 10;
            lptv.topMargin = 80;
            for(int i=0; i<valid_contents.length; i++) {
                TextView tv = new TextView(ViewTopicActivity.this);
                tv.setText(valid_profiles[i]+" :");
                tv.setTextSize(20);
                tv.setTextColor(Color.rgb(255, 255, 255));
                tv.setId(i);
                ll.addView(tv, lptv);
                EditText et = new EditText(ViewTopicActivity.this);
                et.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
                et.setFocusable(false);
                et.setFocusableInTouchMode(false);
                et.setClickable(false);
                et.setText(valid_contents[i]);
                et.setBackgroundResource(R.drawable.edit_text_shape);
                et.getBackground().setAlpha(100);
                et.setId(1000+i);
                ll.addView(et, lp);
            }
        }
    } catch (Exception e) {
        t.setVisibility(View.VISIBLE);
        t.setText("اشکالی در برنامه یا اتصال به اینترنت وجود دارد. برای تلاش مجدد لطفا بر روی این متن کلیک کنید.");
    }
}
 
開發者ID:m47h4r,項目名稱:arch-users-forum,代碼行數:63,代碼來源:ViewTopicActivity.java


注:本文中的android.widget.EditText.setId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。