效果图,有点没有设计美感,哈哈,凑合着看吧
关于json,我对json有一定的了解,所以这个项目我用自己构建的服务器输出json数据,文件名json.php
php代码如下
<?php
$json="{'data':1,'students':[{
'name':'张三','age':22,'url':'http://192.168.1.103/pictures/pic1.jpg'},{
'name':'李四','age':23,'url':'http://192.168.1.103/pictures/pic2.jpg'},{
'name':'王五','age':26,'url':'http://192.168.1.103/pictures/pic3.jpg'},{
'name':'刘流','age':32,'url':'http://192.168.1.103/pictures/pic4.jpg'},{
'name':'陈曦','age':22,'url':'http://192.168.1.103/pictures/pic5.jpg'}]}";
echo $json;
?>
Android文件目录图:
Android配置页AndroidMenifests.xml代码如下
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.imooc.capton.json">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://s