val textView = TextView(context)
textView.gravity = Gravity.CENTER
val textViewPadding = QMUIDisplayHelper.dpToPx(4)
textView.setPadding(textViewPadding, textViewPadding, textViewPadding, textViewPadding)
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,14f)
textView.setBackgroundColor(Color.BLUE)
val textSize = QMUIDisplayHelper.dpToPx(60)
textView.setTextColor(Color.BLACK)
textView.text = currentChildCount.toString() +""
val lp = ViewGroup.LayoutParams(textSize, textSize)
// 设置背景颜色
textView.background = ColorDrawable(Color.LTGRAY)
// 设置Text宽高大小
textView.width =1400
textView.height =300
网友评论