Я создал CardView (пользовательский вид) и использует его в LinearLayout: 4 ряда из 4 CardViews. Я хочу, чтобы каждая строка была единственной, отображаемой на экране, и прокручивалась между ними.android ScrollView минимизирует мои позиции высота
Когда я использую только LinearLayout (без ScrollView) - я вижу, что первая строка ViewCards имеет размер экрана - как и я. НО - когда я добавляю ScrollView, он сжимает все 4 строки до половины основного экрана. (я пытался положить Scrollview внутри/над новой обертке/внутренний LinearLayouts - все причины же неправильно (для меня) результатов)
ЭТО XML БЕЗ ScrollView:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.example.trytoget.ViewCard
android:id="@+id/viewCard1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.example.trytoget.ViewCard
android:id="@+id/viewCard5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard7"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard8"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.example.trytoget.ViewCard
android:id="@+id/viewCard9"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard10"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard11"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard12"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.example.trytoget.ViewCard
android:id="@+id/viewCard13"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard14"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard15"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
<com.example.trytoget.ViewCard
android:id="@+id/viewCard16"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
</com.example.trytoget.ViewCard>
</LinearLayout>
</LinearLayout>
, где и как я должен поместить мой ScrollView?
мой ViewCard.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/cardFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#222222"
android:layout_margin="3dp"
>
<ImageView
android:id="@+id/cardBack"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#111111"
android:src="@drawable/ic_launcher"
/>
<ImageView
android:id="@+id/cardFront"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#111111"
android:src="@drawable/ic_launcher"
/>
</FrameLayout></LinearLayout>