修改字体的粗细
tipTextView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//加粗tipTextView.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));//常规
设置字体的颜色
leftTextView.setTextColor(context.getResources().getColor(R.color.black_191919));
设置显示隐藏
rightView.setVisibility(View.VISIBLE);
设置LayoutParams(设置间距和宽度)
kotlin写法:
button.setOnClickListener {val layoutParams = it.layoutParams as ConstraintLayout.LayoutParamslayoutParams.width = DpAndPx.Dp2Px(188f)layoutParams.leftMargin = DpAndPx.Dp2Px(100f)it.layoutParams = layoutParams}