【发布时间】:2017-07-10 15:55:27
【问题描述】:
列表视图包含球队,球队包含球员。 我有这个由回收适配器填充的列表视图,但我找不到它从哪里得到底部的最后一个填充? 对于我添加到列表中的每个项目,它都会在底部添加更多填充。
如何删除团队底部的填充?
这是保存团队的 xml 布局。
<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>
这个 xml 包含玩家
<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>
用户看到的就是这个视图
<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>
【问题讨论】:
-
是的,我已经看到了。也许在这种情况下我不需要剪贴板?因为我没有问题或滚动问题..
标签: java android android-layout listview android-studio