I have a TextView which firstly shows a small portion of a long text.
The user can press a \"see more\" button to expand the TextView and s
Step 1
Step 2
Step 3
var isTextViewClicked = true
if (binding.overviewText.lineCount > 3)
binding.seeMoreImage.visibility = View.VISIBLE
binding.seeMoreImage.setOnClickListener {
isTextViewClicked = if(isTextViewClicked){
binding.overviewText.maxLines = Integer.MAX_VALUE
binding.seeMoreImage.setImageResource(R.drawable.ic_arrow_up)
false
} else {
binding.overviewText.maxLines = 3
binding.seeMoreImage.setImageResource(R.drawable.ic_arrow_down)
true
}
}