Я пытаюсь сделать compaundView, но когда я пытаюсь измерить ребенка, они не прорисованы и макет (в режиме просмотра) сильно отстает
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
// Try for a width based on our minimum
val minw: Int = suggestedMinimumWidth
val w: Int = View.resolveSizeAndState(minw, widthMeasureSpec, 1)
val w4 = w / 4
Timber.e("width $w")
//set personal sizes
setLL(tvText, w)
setLL(imMarker, w / 3, Gravity.BOTTOM or Gravity.END)
setMeasuredDimension(w, w)
}
private fun setLL(view: View, size: Int, gravity: Int? = null) {
Timber.e("setLL width $size")
val ll = if (gravity != null) {
LayoutParams(size, size, gravity)
} else {
LayoutParams(size, size)
}
view.layoutParams = ll
view.measure(MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY))
}