首先是MainActivity的布局文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main"
android:layout_width="match_parent" android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.myapplication.MainActivity">
<ListView
android:id="@+id/main_list"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</RelativeLayout>
然后再来写子布局文件list_layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/list_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
Bena包
package bean;
import java.util.List;
/**
* Created by on 2017/1/4.
*/
public class Bean {
/**
* status : 10000
* data : {"docinfo":[{"uid":"1718","docid":"2016041303","userid":"2016041303","name":"赵治国","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/Kzyisheng/2/ad787f4219a33e23.png?imageView2/1/w/200/h/200","office_id":"7","office_name":"皮肤性病科","good_at":"痤疮,过敏性皮肤病,性传播疾病以及病毒感染皮肤病的诊断与治疗。","desc":"","jobs":"主治医师","hos_name":"中国人民解放军空军总医院","reg_id":"2","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":1},"type_3":{"type":"3","is_on":1},"type_4":{"type":"4","is_on":0},"type_5":{"type":"5","is_on":0}},"auth_type":"认证医生","ys_attribute":""},{"uid":"1664","docid":"2016040536","userid":"2016040536","name":"高伟","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/Kzyisheng/2/c348ab4a25d09d85.png?imageView2/1/w/200/h/200","office_id":"7","office_name":"皮肤性病科","good_at":"常见皮肤病诊断治疗","desc":" ","jobs":"主治医师","hos_name":"北京大学第一医院","reg_id":"2","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":0},"type_3":{"type":"3","is_on":1},"type_4":{"type":"4","is_on":0},"type_5":{"type":"5","is_on":0}},"auth_type":"认证医生","ys_attribute":""},{"uid":"1786","docid":"2016036959","userid":"2016036959","name":"程明明","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/Kzyisheng/2/d5d6074a6ce7d302.JPG?imageView2/1/w/200/h/200","office_id":"7","office_name":"皮肤性病科","good_at":"常见皮肤病","desc":" ","jobs":"主治医师","hos_name":"北京大学第一医院","reg_id":"2","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":0},"type_3":{"type":"3","is_on":1},"type_4":{"type":"4","is_on":0},"type_5":{"type":"5","is_on":0}},"auth_type":"认证医生","ys_attribute":""},{"uid":"719","docid":"2015117732","userid":"2015117732","name":"贾玲芝","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/yisheng/719/yishengtouxiang3781469018682.jpg?imageView2/1/w/200/h/200","office_id":"7","office_name":"皮肤性病科","good_at":"皮肤科","desc":"我是一名医生","jobs":"主治医师","hos_name":"日照市皮肤病防治所","reg_id":"22","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":0},"type_3":{"type":"3","is_on":0},"type_4":{"type":"4","is_on":0},"type_5":{"type":"5","is_on":0}},"auth_type":"认证医生","ys_attribute":""},{"uid":"3071","docid":"13956085560270","userid":"13956085560270","name":"丁成标","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/yisheng/3071/yishengtouxiang7191479396210.jpg?imageView2/1/w/200/h/200","office_id":"8","office_name":"中医科","good_at":"中西医结合治疗各类皮肤病及内妇科疾病。","desc":"","jobs":"主治医师","hos_name":"肥东县中医院","reg_id":"3","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":1},"type_3":{"type":"3","is_on":0},"type_4":{"type":"4","is_on":1},"type_5":{"type":"5","is_on":0}},"auth_type":"认证医生","ys_attribute":""},{"uid":"1369","docid":"2016021257","userid":"2016021257","name":"张晓红","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/yisheng/1369/yishengtouxiang5911469011153.jpg?imageView2/1/w/200/h/200","office_id":"7","office_name":"皮肤性病科","good_at":"常见皮肤病性病的诊疗","desc":"","jobs":"主治医师","hos_name":"北京京煤集团总医院","reg_id":"2","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":1},"type_3":{"type":"3","is_on":1},"type_4":{"type":"4","is_on":1},"type_5":{"type":"5","is_on":0}},"auth_type":"","ys_attribute":""},{"uid":"896","docid":"2015114760","userid":"2015114760","name":"汪艳梅","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/yisheng/896/1467214863.jpg?imageView2/1/w/200/h/200","office_id":"7","office_name":"皮肤性病科","good_at":"皮肤病","desc":"医师","jobs":"医师","hos_name":"昆明医学院第二附属医院","reg_id":"30","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":1},"type_3":{"type":"3","is_on":1},"type_4":{"type":"4","is_on":1},"type_5":{"type":"5","is_on":0}},"auth_type":"认证医生","ys_attribute":"可开处方"},{"uid":"2958","docid":"13654868158253","userid":"13654868158253","name":"王少飞","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/Kzyisheng/3/51b167c813a99f19.png?imageView2/1/w/200/h/200","office_id":"7","office_name":"皮肤性病科","good_at":"纯中药结合308准分子激光,红蓝光,半导体激光治疗:青春期痤疮,银屑病,鱼鳞病,白癜风,荨麻疹,湿疹,神经性皮炎,面部黄褐斑,过敏性紫癜,带状疱疹及后遗神经痛,手足癣等各种顽固性疾病及性传播疾病。","desc":"","jobs":"主治医师","hos_name":"赤峰市钓鱼台社区卫生服务站","reg_id":"19","service":{"type_1":{"type":"1","is_on":1},"type_2":{"type":"2","is_on":1},"type_3":{"type":"3","is_on":1},"type_4":{"type":"4","is_on":1},"type_5":{"type":"5","is_on":0}},"auth_type":"认证医生","ys_attribute":"可开处方"},{"uid":"1445","docid":"2016029001","userid":"2016029001","name":"禚洪萍","answers":0,"headimg":"https://ohdrjnjvc.qnssl.com//attached/yisheng/1445/yishengtouxiang2211464080993.jpg