我想有一个灰色的淡淡的色调中的背景EditText来看,几乎像文本总是不断强调,我需要以编程方式添加此.我试过setBackground(),setBackgroundTintList(),setBackgroundTintMode(),但没有他们中的一个似乎工作.
这是代码......
EditText label = new EditText(this);
label.setTextSize(4*dp);
label.setTypeface(null,Typeface.BOLD_ITALIC);
RelativeLayout.LayoutParams labelParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
labelParams.setMargins(80,0,0,0);
labelParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
labelParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
label.setLayoutParams(labelParams);
rootView.addView(label);
Run Code Online (Sandbox Code Playgroud)