Reputation: 983
I have a ListView
which contains a custom layout.
Each row of the list View look like this:
The row contains 2 LinearLayouts
, one for Date and one for Progress details. The progress Details Layout consits of 2 TextViews
(Heading and data below it) and 1 Button
(View More).
When the user clicks 'View More
' button the data below the heading expands to 10-12 lines.
My problem is that when the TextView
expands, a scrollbar
comes at the edge and the user has to scroll to read. The width of the row does not change i.e the row does not expand.
I want the row width to expand so that the user does not have to scroll to read the text.
I did read a lot and have already tried the following options but they did not work
1. android:scrollbar="none"
2. View.setOverScrollMode(View.OVER_SCROLL_NEVER);
3. View.setScrollContainer(false);
Please help me with this.
Upvotes: 0
Views: 92
Reputation: 853
Use a expandable List View
such that the normal view of your list will have the image that you provided and on clicking that view it will expand to reveal the details that you wanted to show by clicking the view more
option(in your image)
Here is a tut link for more info.
Upvotes: 0
Reputation: 103
Try to use LayoutParams and change the height programatically inside the listener for you Button.
LayoutParams should derive from the type of layout containing your LinearLayout. If for instance it is a RelativeLayout, it will look something like that:
int heightForRow = 100;
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
params.height = heightForRow;
yourLinearLayout.setLayoutParams(params);
Please note that your LinearLayout must then be inside another layout (RelativeLayout in the example)
Upvotes: 0
Reputation: 973
You have to use exapanding listview animation for that you can use this lib for that https://github.com/nhaarman/ListViewAnimations
Upvotes: 1