[Android] 代码中动态设置shape

TextView textView = new TextView(this);
GradientDrawable drawable = new GradientDrawable();
drawable.setCornerRadius(5);
drawable.setStroke(1, Color.parseColor("#cccccc"));
drawable.setColor(Color.parseColor("#eeeeee"));
textView.setBackgroundDrawable(drawable);

 

posted @ 2018-05-19 22:03  NOIP/NOI辅导  Views(1751)  Comments(0Edit  收藏  举报