Roman
Roman

Reputation: 2079

Multiple custom views in Scroll view Android

I created custom view and want to insert multiple numbers of it to the Scroll list, but always only one view is displayed:

  <ScrollView 
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_below="@+id/buttonsPart"
  android:id="@+id/scrollView1"
  android:background="@drawable/greylayer">

  <LinearLayout 
      android:layout_width="match_parent"
      android:layout_height="wrap_content">

       <com.test.app.canvas.MatchCanvas
      android:layout_width="fill_parent"
      android:layout_height="400px"/>

      <com.test.app.canvas.MatchCanvas
      android:layout_width="fill_parent"
      android:layout_height="400px"/>

  </LinearLayout>

I believe its easily possible to insert as many custom views to ScrollView, but somehow I still have only 1 instance of MatchCanvas. What should I do?

Upvotes: 0

Views: 899

Answers (1)

Yashwanth Kumar
Yashwanth Kumar

Reputation: 29121

By default LinearLayout is horizontal, so add android:orientation="vertical" to the LinearLayout to resolve the issue.

Upvotes: 4

Related Questions