0

The listview contains teams, and the teams contains players. I have this listview that is filled by a recycleadapter, and i can't locate where it get's the last padding in the bottom from? For every item i add to the list, it adds more padding to the bottom.

How do i remove the padding in the bottom of the teams?

This is how it looks now

This is the xml layout wich hold the teams.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp">

    <android.support.v7.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="5dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Team # X"
                android:textSize="18dp"
                android:gravity="center"
                android:padding="10dp"
                android:id="@+id/make_team_teamName"
                android:textColor="#000000"/>

            <ListView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/make_team_playerList"
                android:paddingBottom="8dp"
                android:clipToPadding="false"
                android:background="@color/colorPrimaryDark">

            </ListView>

        </LinearLayout>
    </android.support.v7.widget.CardView>
</LinearLayout>

This xml holds the players

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.CardView
        android:id="@+id/make_team_player_card"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:backgroundTint="@color/colorPrimary"
        app:cardCornerRadius="4dp"
        >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Player name"
            android:id="@+id/make_team_playerName"
            android:textColor="@color/colorAccent"
            android:gravity="center"
            style="@style/txt_normal"/>
    </android.support.v7.widget.CardView>
</LinearLayout>

This view is what the user see

<LinearLayout 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"
    android:orientation="vertical"
    android:weightSum="10">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="horizontal"
            android:layout_weight="2"
            android:gravity="center">

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/make_team_add_player"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:src="@drawable/add_player"
                android:layout_marginRight="20dp"
                 />

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/make_team_add_team"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:src="@drawable/add_team"
                android:layout_marginLeft="20dp"
                />


        </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="0dp"
        android:layout_weight="8"
        android:id="@+id/make_teams_teamlistView">

        <com.dtu.appname.Adapter.AutofitRecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/make_teams_teamsRecyclerview"
            android:columnWidth="180dp"
            android:clipToPadding="false">


        </com.dtu.appname_v1.Adapter.AutofitRecyclerView>

    </LinearLayout>

    <Button
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentEnd="false"
        android:layout_alignParentBottom="true"
        android:background="@color/colorPrimary"
        android:text="Save"
        android:textColor="@color/colorAccent"
        android:id="@+id/make_teams_done_b"
        />

</LinearLayout>

2 Answers2

0

perhaps it's the listview with id @+id/make_team_playerList

Du.Fantasy
  • 475
  • 2
  • 7
0

android:paddingBottom="8dp" in the XML that holds the teams. Try removing it and see how it goes.

sHOLE
  • 343
  • 4
  • 15
  • I did try to remove it and change it to 0 and 2 etc. but nothing happends.. Maybe it's something in the recycler when it creates or move an item? – Daniel Barner Schultz Feb 22 '17 at 06:16
  • It could be a result of both android:paddingBottom="8dp" and android:clipToPadding="false" Check this out. http://stackoverflow.com/questions/40953049/android-what-does-the-cliptopadding-attribute-do – sHOLE Feb 22 '17 at 06:41
  • tryit that too.. I have red all the solutions with cliptopadding and paddingbottom etc. :( It doesnt help – Daniel Barner Schultz Feb 23 '17 at 06:18