如下图所示,我将 GradientDrawable 作为 textview 的背景。
结果很奇怪:文本被裁剪。
还有代码:
GradientDrawable border = new GradientDrawable();
border.setColor(0x00FFFFFF);
border.setStroke(1,Color.GRAY);
border.setCornerRadius(size);
EditText surname = new EditText(this);
surname.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
surname.setBackground(border);
surname.setTypeface(Stats.fontRegular);
FrameLayout.LayoutParams lps = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, size_x);
surname.setLayoutParams(lps);
view.addView(surname);
如果您知道一种取消裁剪文本的方法,那对我来说将非常有用:)