How do i achieve a page of thumbnails that scroll?



I am trying to add a number of images with ImageView in a layout (7 and a text view to be exact) and i wish for two to fit the entire screen side by side at once and then have the ability using scroll view to scroll down and the next two will come up and fill the screen once in position obviously. however ive tried doing this with weights and i cant figure it out for the life of me how would i achieve this effect in xml?


What i currently have that positions the imageViews side by side and scrolls but has large black areas from one imageView to the next below it as the graphic inside the image view doesnt take the entire view



<?xml version="1.0" encoding="utf-8"?>


<ScrollView xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/afflicted_inc"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/afflicted_inc"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="@drawable/afflicted_inc"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="@drawable/afflicted_inc"/>



</LinearLayout>


<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="@drawable/afflicted_inc"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="@drawable/afflicted_inc"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="@drawable/afflicted_inc"/>

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>



</LinearLayout>


</LinearLayout>
</ScrollView>

No comments:

Post a Comment