简体   繁体   中英

Divider in Android recycler view

I am doing a small Android game where the user needs to assign two players to two teams. My plan is to use a recycler view which lists all existing players (which are stored in a local database).

The items in the recycler view will be possible to reorder. The first two items in the recycler view will be assigned to team A and the next two items will be assigned to team B. The remaining players will not be considered in a team. The implementation of this logic will be fine, there are also enough examples in the web.

But in order to indicate this logic to the user, I would like to offer him some kind of boxes which indidcate the teams. Like in the following wireframe:

在此处输入图像描述

Does anybody have an advice how this should be done? Should I put a View above the recycler view? Alternatively, I am also open for alternative approaches to assign exactly two players (uniquely) to two teams.

如果要使用 RecyclerView,则需要在项目视图中包含分隔符,或者将分隔符作为项目本身。

您需要将这些 Divider 背景放在 recyclerview 下面,计算这些项目的高度并相应地放置它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM