0

I am trying to implement a GridView in my Android app, but it seems the GridView keeps resizing. I have attached a video of this below (notice the scrollbar). Although its subtle, but it's really annoying and hampers with parallax scrolling that I am trying to implement.

Video: GridView Issue

Grid Item Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="120dp"
     android:orientation="vertical"
     android:background="@drawable/card_background"
     >

    <TextView 
         android:id = "@+id/foo"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dp"
         android:layout_marginTop="10dp"
         android:layout_marginRight="10dp"  
         android:layout_marginBottom="40dp"      
         style="@style/PrimaryBlueHeading"
     />

    <View
        android:id="@+id/list_uinderline"
        android:layout_marginTop="10dp"
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@android:color/white"/>



    <Button
        android:id="@+id/bar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:focusable="false"

        android:background="@color/brand_color"
        android:paddingTop="2dp"
        android:paddingBottom="2dp"
        android:text="@string/save"
        android:textColor="@android:color/white" />


</LinearLayout>

GridView Layout:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ProtocolListActivity">
     <!-- android:paddingTop="?android:attr/actionBarSize" --> 


    <GridView
        android:id="@+id/protocol_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:clipToPadding="false"
        android:columnWidth="200dp"
        android:numColumns="auto_fit"
        android:verticalSpacing="50dp"
        android:background="@drawable/backgound_potrait"
        android:horizontalSpacing="50dp"
        android:stretchMode="columnWidth"
        android:scrollbarStyle="outsideOverlay"
        android:gravity="center">
    </GridView>

</RelativeLayout>
bakshi_s
  • 117
  • 1
  • 9
  • Any reason why you are using a GridView instead of a ListView since you only need one column? Watched the video and did not see any resizing – Cumulo Nimbus Mar 26 '14 at 22:35
  • @CumuloNimbus So, in landscape or in bigger screens, it resizes to more columns – bakshi_s Mar 26 '14 at 22:41
  • Gotcha. Well one issue I have personally run into with GridView resizing is when items are added dynamically, the height get set such that it only shows one row. [This solution](http://stackoverflow.com/questions/6005245/how-to-have-a-gridview-that-adapts-its-height-when-items-are-added) fixed my problem but am not sure if this will help your problem – Cumulo Nimbus Mar 26 '14 at 22:45
  • @CumuloNimbus Nope, tried every answer on that page, still the same story, But thanks for the suggestion. – bakshi_s Mar 26 '14 at 23:02
  • Ya sorry.. sucks how glitchy GridView can be to implement on Android, its such a great UI tool – Cumulo Nimbus Mar 28 '14 at 14:52

0 Answers0