0

I'm working with gridView, each item has an image and a TextView in the footer.

All images have the same size, so I use match_parent or wrap_content as required.

But the screen only show one line and a half on items, it scroll, and that is perfect, but I would like to show two complete rows and then scroll.

Also, when I run the app in small devices, only show 1 line, I would like to show 2 lines always.

I tried to use this example, but it doesn't work to me because stop scrolling.

Here, some of my code XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_app">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/black"
    android:id="@+id/header"
    android:padding="10dp">
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/icon_back"
        android:src="@drawable/ic_back" />
</RelativeLayout>
<com.xetux.util.ExpandableHeightGridView
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:gravity="center"
    android:horizontalSpacing="15dp"
    android:isScrollContainer="true"
    android:numColumns="3"
    android:padding="10dp"
    android:id="@+id/family_grid_view"
    android:layout_below="@+id/header"
    android:verticalSpacing="15dp"/>
<!--<GridView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp"
    android:id="@+id/family_grid_view"
    android:horizontalSpacing="15dp"
    android:verticalSpacing="15dp"
    android:layout_below="@+id/header"
    android:numColumns="3"/>-->
</RelativeLayout>

and each item XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/family_image"
    android:background="@drawable/bg_family">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/black_transparency"
        android:text="FAMILIA"
        android:gravity="center"
        android:id="@+id/family_name"
        android:padding="10dp"
        android:layout_alignParentBottom="true"
        android:textColor="@color/white"
        android:textSize="15sp"/>
</RelativeLayout>
Community
  • 1
  • 1
Marlaurita
  • 583
  • 3
  • 11
  • 26

1 Answers1

0

I think your image size is big. You can checkout for supporting multiple screen tutorials. Try using small images for small screen.

Lalit Jadav
  • 1,409
  • 1
  • 15
  • 38