I'm trying to resize at runtime a simple HorizontalScrollView that contains only a Linearlayout this way:
HorizontalScrollView h = (HorizontalScrollView)findViewById(R.id.scrollview_row_1);
h.setLayoutParams(new FrameLayout.LayoutParams(50,50));
but then i get this error:
E/AndroidRuntime(5098): FATAL EXCEPTION: main
E/AndroidRuntime(5098): java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams
How should I resize my scrollView properly?
that's because the HorizontalScrollView is not inside a FrameLayout. the layout params have to match the root view of your HorizontalScrollView.