I\'m having a lot of trouble trying solve the issue of having a static height scrollable area within a layout. I have three long lists that need to be displayed on the same scre
My simple solution.
Set ScrollView
heigh in xml:
android:layout_height="wrap_content"
Add this code to set Max Height to 200 if current measured Height is > 200
sv.measure(0, 0);
if (nsv.getMeasuredHeight() > 200) {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, 200);
sv.setLayoutParams(lp);
}
ScrollView
in my example is into LinearLayout
, so I used LinearLayout.LayoutParams
.