Sunday, 11 January 2015

Android GridView Text overlapping



I try now for two days to create a working GridView, but it won't work, this is how it looks like:


enter image description here


You see, my problem is overlapping text. I already found out, that the height of a GridView Row is set by the last item. My XML looks so:



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Startbildschirm">


<GridView
android:numColumns="2"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:horizontalSpacing="5dp"
android:verticalSpacing="5dp"
/>
</RelativeLayout>


My idea to fix this was to get the Height of the longest view in one Row and then set it as MinHeight to the last view. My problem was, that views are only saved as long they are visible, so on down and upscrolling the height was different again. Does anyone have an idea how to fix this?


No comments:

Post a Comment