您好,
我需要制作一个屏幕,可以显示出竞标的赢家和输家。
它需要呈现如下的样子:
TextView - Winners
Name and bid amount
Name and bid amount
Name and bid amount
--------------------
Textview - Losers
Name and bid amount
Name and bid amount
Name and bid amount
Name and bid amount
来自Web服务的响应如下:
{
"winningBids": [
{
"amount": 500,
"quantity": 1,
"name": "Craig",
"status": "WINNING"
}
],
"losingBids": [
{
"amount": 461,
"quantity": 1,
"name": "Bob",
"status": "LOSE"
},
{
"amount": 460,
"quantity": 1,
"name": "James",
"status": "LOSE"
}
]
}
我考虑在同一个屏幕上使用2个RecyclerView,但我认为这不可行,因为获胜和失败列表可能会非常长,这意味着有两个不同滚动区域的部分。有没有办法将获胜和失败放在同一个RecyclerView中,并用标题指示获胜者和失败者列表以及获胜者和失败者列表之间的线?
我的屏幕目前是:
<?xml version="1.0" encoding="utf-8"?>
<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.example.app.BiddingHistoryActivity"
tools:showIn="@layout/activity_bidding_history">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:padding="@dimen/padding_16"
android:background="@drawable/border_bottom"
android:layout_height="wrap_content"/>
</RelativeLayout>
我的行是一个简单的TextView,用于显示名称,另一个TextView用于显示出价金额。
如果您有实现这个功能的想法,将不胜感激。
谢谢
RecyclerView
中简单地使用2个不同的ViewHolders
进行填充 - 一个用于标题winner/looser
,另一个用于每一行? - yennsarah