Search code examples
androidxmllayoutandroid-recyclerviewfade

Recyclerview List doesnt reach the bottom of the list


I'm trying to display a recyclerview list under some content. The problem I have is that my recyclerview list doesn't reach the end of it. The last icon by example is just half to see. Also if its possible, I would like to know how I can fade out my list at the top so that it does't seem cut off.

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

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="1"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:background="?attr/selectableItemBackground"
        tools:context="match_parent"
        xmlns:tools="http://schemas.android.com/tools">

        <com.github.siyamed.shapeimageview.CircularImageView
            android:layout_width="87dp"
            android:layout_height="63dp"
            android:src="@drawable/snappy"
            app:siBorderWidth="2dp"
            app:siBorderColor="@color/colorPrimary"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_weight="0.02" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Name"
            android:id="@+id/textView3"
            android:textColor="#116c99"
            android:typeface="sans"
            android:layout_marginTop="-95dp"
            android:layout_marginLeft="110dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="Daten"
            android:id="@+id/textView5"
            android:layout_marginTop="0dp"
            android:layout_marginLeft="110dp" />

        <TextView
            android:layout_width="263dp"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:id="@+id/textView6"
            android:textSize="10dp"
            android:layout_marginLeft="110dp"
            android:layout_marginTop="5dp"
            android:text="@string/statusId" />


        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#d8d8d8"
            android:layout_marginTop="15dp"
            android:layout_marginRight="15dp"
            android:layout_marginLeft="15dp" />

        <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Kontaktschriftzug"
        android:id="@+id/textView4"
        android:layout_marginTop="5dp"
            android:textSize="12dp"
        android:textColor="#0071a6"
        android:typeface="sans"
        android:textStyle="bold"
            android:layout_marginLeft="15dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="Kategorie"
            android:id="@+id/textView77"
            android:layout_marginTop="10dp"
            android:textSize="10dp"
            android:textColor="#848484"
            android:typeface="sans"
            android:layout_marginLeft="15dp" />

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:context="com.appmak.ron.recycleviewer.MainActivity"
        tools:showIn="@layout/activity_main">

        <android.support.v7.widget.RecyclerView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/recycleviewMeineKarte">
        </android.support.v7.widget.RecyclerView>

    </RelativeLayout>

</LinearLayout>

Solution

  • Remove this line android:weightSum="1" here:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="1"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:background="?attr/selectableItemBackground"
        tools:context="match_parent"
        xmlns:tools="http://schemas.android.com/tools">
    

    Remove this line android:layout_weight="0.02" here:

    <com.github.siyamed.shapeimageview.CircularImageView
            android:layout_width="87dp"
            android:layout_height="63dp"
            android:src="@drawable/snappy"
            app:siBorderWidth="2dp"
            app:siBorderColor="@color/colorPrimary"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_weight="0.02" />
    

    And you need to use the weight property for all the Views to work as expected!