【问题标题】:parsing json and display with recycler view and card view解析 json 并使用回收站视图和卡片视图显示
【发布时间】:2017-09-08 12:45:40
【问题描述】:

我需要解析 json,然后在回收站视图的卡片中查看它。由于我还是一名大三学生,因此我需要通过简单的步骤来帮助我做到这一点。我要说的一个重要说明是,我需要在片段中制作这个视图而不是活动。

提前谢谢你。 这是我要解析的json代码。

{"teamMembersList":[{"id":1,"name":"Mona Shahien","position":"DIRECTOR","description":"DIRECTOR","image":"209.126.105.42:8001/Images/TeamMembers/1.jpg"},{"id":2,"name":"Beshoy Fayez","position":"SENIOR PROGRAM MANAGER","description":"SENIOR PROGRAM MANAGER : Very Good ","image":"209.126.105.42:8001/Images/TeamMembers/2.jpg"},{"id":3,"name":"Sarah ElRawy","position":"SENIOR PROGRAM MANAGER","description":"SENIOR PROGRAM MANAGER : don\u0027t know","image":"209.126.105.42:8001/Images/TeamMembers/3.jpg"}]}

我为卡片视图创建了布局,而另一个布局具有回收器视图 这是卡片视图布局的代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v4.widget.CircleImageView
        android:id="@+id/image_of_our_teams"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/name_of_team_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/position_of_team_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</RelativeLayout>
</android.support.v7.widget.CardView>

这是包含回收站视图的布局:

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
    android:id="@+id/my_recycler_view"
    android:scrollbars="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
</RelativeLayout>

现在我需要做什么?

【问题讨论】:

  • 你用的是什么网络库?
  • 问题太宽泛,请提供您的代码

标签: android json android-recyclerview cardview


【解决方案1】:

您需要了解更多关于 CardView、RecyclerView 和在 android 中解析 JSON 的知识。以下链接将有所帮助:

RecyclerView 和 CardView:

在 Android 中解析 JSON:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-30
    • 2020-07-06
    • 1970-01-01
    相关资源
    最近更新 更多