I have a textView inside a recyclerview currently that looks like this:
The full text says: "This is the place where I would put the information about the food item. I want to truncate the line to only show 3 lines and then when I press on the caret, it will expand to the maximum amount of lines."
If I click on the caret (the little down arrow at the top), I want it to expand so that I can see all the lines.
In my recyclerview adapter, I have the following code:
if (holder instanceof InfoViewHolder) {
((InfoViewHolder) holder).more.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!expandedInfo) {
((InfoViewHolder) holder).info.setMaxLines(Integer.MAX_VALUE);
expandedInfo = true;
}
((InfoViewHolder) holder).info.setMaxLines(3);
notifyItemChanged(position);
}
});
}
I'm just manipulating the maxLines in the textView to try and expand the space it will take in the textView so that the view will adjust itself when I notifyItemChanged, however, this does not work and my information textview does not expand.
Can anyone tell me how I can get this to work properly?