本文整理汇总了Java中android.widget.EditText.setBackgroundDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setBackgroundDrawable方法的具体用法?Java EditText.setBackgroundDrawable怎么用?Java EditText.setBackgroundDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setBackgroundDrawable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBody
import android.widget.EditText; //导入方法依赖的package包/类
private void initBody(RelativeLayout rlBody, float ratio) {
svContent = new ScrollView(activity);
rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
LinearLayout llContent = new LinearLayout(activity);
llContent.setOrientation(LinearLayout.HORIZONTAL);
svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
etContent = new EditText(activity);
int padding = (int) (DESIGN_LEFT_PADDING * ratio);
etContent.setPadding(padding, padding, padding, padding);
etContent.setBackgroundDrawable(null);
etContent.setTextColor(0xff3b3b3b);
etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
etContent.setText(sp.getText());
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT);
lp.weight = 1;
llContent.addView(etContent, lp);
etContent.addTextChangedListener(this);
rlThumb = new RelativeLayout(activity);
rlThumb.setBackgroundColor(0xff313131);
int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio);
int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio);
lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth);
lp.rightMargin = lp.bottomMargin = lp.topMargin = padding;
llContent.addView(rlThumb, lp);
aivThumb = new AsyncImageView(activity) {
public void onImageGot(String url, Bitmap bm) {
thumb = bm;
super.onImageGot(url, bm);
}
};
aivThumb.setScaleToCropCenter(true);
RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth);
rlThumb.addView(aivThumb, rllp);
aivThumb.setOnClickListener(this);
initThumb(aivThumb);
xvRemove = new XView(activity);
xvRemove.setRatio(ratio);
rllp = new RelativeLayout.LayoutParams(xWidth, xWidth);
rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
rlThumb.addView(xvRemove, rllp);
xvRemove.setOnClickListener(this);
}
示例2: getMainBody
import android.widget.EditText; //导入方法依赖的package包/类
private LinearLayout getMainBody() {
LinearLayout llMainBody = new LinearLayout(getContext());
llMainBody.setOrientation(LinearLayout.VERTICAL);
LayoutParams lpMain = new 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());
LayoutParams lpContent = new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
lpContent.weight = 1;
llMainBody.addView(llContent, lpContent);
// share content editor
etContent = new EditText(getContext());
etContent.setGravity(Gravity.LEFT | Gravity.TOP);
etContent.setBackgroundDrawable(null);
etContent.setText(String.valueOf(shareParamMap.get("text")));
etContent.addTextChangedListener(this);
LayoutParams lpEt = new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpEt.weight = 1;
etContent.setLayoutParams(lpEt);
llContent.addView(etContent);
llContent.addView(getThumbView());
llMainBody.addView(getBodyBottom());
return llMainBody;
}
示例3: initEditText
import android.widget.EditText; //导入方法依赖的package包/类
/**
* 初始化 {@link #etInput}
*/
private void initEditText()
{
etInput = new EditText(context);
etInput.setCursorVisible(false);
etInput.setBackgroundDrawable(null);
etInput.setTextColor(Colors.TRANSPARENT);
setEditTextLength(textLength);
addDefaultTextChangeListener();
}
示例4: initBody
import android.widget.EditText; //导入方法依赖的package包/类
private void initBody(RelativeLayout rlBody, float ratio) {
svContent = new ScrollView(activity);
rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
LinearLayout llContent = new LinearLayout(activity);
llContent.setOrientation(LinearLayout.VERTICAL);
svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
etContent = new EditText(activity);
int padding = (int) (DESIGN_LEFT_PADDING * ratio);
etContent.setPadding(padding, padding, padding, padding);
etContent.setBackgroundDrawable(null);
etContent.setTextColor(0xff3b3b3b);
etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
etContent.setText(sp.getText());
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
llContent.addView(etContent, lp);
etContent.addTextChangedListener(this);
rlThumb = new RelativeLayout(activity);
rlThumb.setBackgroundColor(0xff313131);
int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio);
int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio);
lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth);
lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding;
llContent.addView(rlThumb, lp);
aivThumb = new AsyncImageView(activity) {
public void onImageGot(String url, Bitmap bm) {
thumb = bm;
super.onImageGot(url, bm);
}
};
aivThumb.setScaleToCropCenter(true);
RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth);
rlThumb.addView(aivThumb, rllp);
aivThumb.setOnClickListener(this);
initThumb(aivThumb);
xvRemove = new XView(activity);
xvRemove.setRatio(ratio);
rllp = new RelativeLayout.LayoutParams(xWidth, xWidth);
rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
rlThumb.addView(xvRemove, rllp);
xvRemove.setOnClickListener(this);
}