本文整理汇总了Java中android.widget.EditText.setBackgroundResource方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setBackgroundResource方法的具体用法?Java EditText.setBackgroundResource怎么用?Java EditText.setBackgroundResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setBackgroundResource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setEditTextDisabled
import android.widget.EditText; //导入方法依赖的package包/类
private static void setEditTextDisabled(EditText editText) {
editText.setInputType(InputType.TYPE_NULL);
editText.setTextIsSelectable(true);
editText.setKeyListener(null);
editText.setBackgroundResource(R.drawable.edit_text_readonly);
int color = StyledAttributesHelper.getColor(editText.getContext(), android.R.attr.textColorSecondary, 0);
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(color));
((ViewGroup) editText.getParent()).setAddStatesFromChildren(false);
}
示例2: 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);
}
示例3: setPinBackgroundRes
import android.widget.EditText; //导入方法依赖的package包/类
public void setPinBackgroundRes(@DrawableRes int res) {
this.mPinBackground = res;
for (EditText editText : editTextList)
editText.setBackgroundResource(res);
}
示例4: 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("اشکالی در برنامه یا اتصال به اینترنت وجود دارد. برای تلاش مجدد لطفا بر روی این متن کلیک کنید.");
}
}