【发布时间】:2018-10-23 22:22:07
【问题描述】:
我有一个 recyclerView,它将使用 databinding 根据 JSON 结果填充,我想要做的是 检查/比较开始日期和过期时间日期查看“交易”是否已过期(如果过期,将出现带有文本“交易已过期”的文本视图)
"DealsPageInfo": [
{
"DisplayName": "string",
"StartDate": "2018-04-27T03:06:18.890Z",
"ExpiredDate": "2018-04-27T03:06:18.890Z",
"Url": "string",
"ImageUrl": "string",
"ShortDescription": "string"
}
这是我的一些问题:
* 我应该使用 DATE / String 来存储对象吗?
* 我应该在哪里执行此操作?在我的片段/适配器下?
如果提供任何来源/示例,请欣赏。
<TextView
android:id="@+id/list_offers_startDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:text="@{offers.StartDate}"
android:textColor="@color/colorGrayText"
android:textSize="@dimen/list_fontsize"
/>
<TextView
android:id="@+id/list_offers_endDate"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="@{offers.ExpiredDate}"
android:textColor="@color/colorGrayText"
android:textSize="@dimen/form_fontsize"
/>
【问题讨论】:
标签: android datetime android-recyclerview android-databinding