本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
示例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("اشکالی در برنامه یا اتصال به اینترنت وجود دارد. برای تلاش مجدد لطفا بر روی این متن کلیک کنید.");
}
}