简体   繁体   English

Android滚动视图中的多个自定义视图

[英]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. 我相信可以轻松地向ScrollView插入许多自定义视图,但是不知何故我仍然只有1个MatchCanvas实例。 What should I do? 我该怎么办?

默认情况下,LinearLayout是水平的,因此将android:orientation="vertical"到LinearLayout中即可解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM