You can create an xml and call it scrollview.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
Via code, you get the container that will receive the views.
View scrollView = LayoutInflater.from([contexto aqui]).inflate(R.layout.scrollview, null);
LinearLayout mLinearContainer = (LinearLayout)scrollView .findViewById(R.id.linearContent);
// nesse mLinearContainer você adiciona as views
What’s the mistake ?
– ramaral