I had the following problem: I made a form with a gallery, instead of images the gallery contains elements from one of my classes, everything inside each gallery element is perfectly displayed. I removed the space between the images using:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Gallery android:id="@+id/galleryid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:spacing="0dip" android:padding="0dip" android:layout_weight="1" />
gallery elements:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="75dip" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal" android:background="#ffffff"> <TextView android:id="@+id/frame_number" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="-" android:textSize="12dip" android:textColor="#ffffff" android:background="#000000" android:gravity="center" /> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:gravity="center_horizontal"> <TextView android:id="@+id/frame_shot1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-" android:textSize="18dip" android:textColor="#000000" /> <TextView android:id="@+id/frame_shot2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-" android:textSize="18dip" android:textColor="#000000" /> </LinearLayout> <TextView android:id="@+id/frame_total" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="---" android:textSize="38dip" android:textColor="#000000"/> </LinearLayout>
buuuuuuuuuuuuuuuutu, I have a problem, there is an empty space at the beginning and at the end of the gallery without elements. the fact is that in my gallery there are many objects that can really scroll horizontally, but I want to get rid of these spaces, so the very first thing that is to the left of the gallery is the first element, and the very last when you scroll to the right is the correct element.
Edit 08/16 Still with the same problem in the project, here I leave an image of exactly what I'm trying to get rid of, this is black space at the beginning (also located at the end of the gallery on the other side)

android gallery horizontal-scrolling
Ale K.
source share