分享

php做接口+android 请求API接口并展示到ListView例子

 A芝兰之室 2017-10-14

知识点:

php: 处理json问题,unicode转码实现

android:ListView使用与性能优化;handler消息队列机制;androidHTTP请求,activity知识等等:

效果如下:





文件结构:





MainActivity主活动界面展示:

ListActivity 跳转活动界面展示ListView内容

Person 数据填充实体

PersonAdapter ListView数据接口

Util工具类,负责网络请求以及json解析等



Manifest文件:


  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <manifest xmlns:android="http://schemas./apk/res/android"  
  3.     package="com.example.tes.api" >  
  4.   
  5.     <application  
  6.         android:allowBackup="true"  
  7.         android:icon="@mipmap/ic_launcher"  
  8.         android:label="@string/app_name"  
  9.         android:supportsRtl="true"  
  10.         android:theme="@style/AppTheme" >  
  11.         <activity  
  12.             android:name=".MainActivity"  
  13.             android:label="@string/app_name"  
  14.             android:theme="@style/AppTheme.NoActionBar" >  
  15.             <intent-filter>  
  16.                 <action android:name="android.intent.action.MAIN" />  
  17.                 <category android:name="android.intent.category.LAUNCHER" />  
  18.             </intent-filter>  
  19.         </activity>  
  20.         <activity android:name=".ListActivity">  
  21.             <intent-filter>  
  22.                 <action android:name="android.intent.action.VIEW" />  
  23.                 <category android:name="android.intent.category.DEFAULT" />  
  24.             </intent-filter>  
  25.         </activity>  
  26.     </application>  
  27.     <uses-permission android:name="android.permission.INTERNET"></uses-permission>  
  28.   
  29. </manifest>  


主界面两个按钮功能:

点击按钮1获取textView里面的id,传递id参数,向服务器发起post请求;获取结果解析json,展示到按钮下面的显示TextView中

点击按钮2跳转到第二个意图,向服务器发起post请求,将结果填充到ListView中



服务端 api.php:


  1. <?php  
  2. header("Content-Type:application/json;charset=utf-8");  
  3. $result = [  
  4.     "status" => 200,  
  5.     "msg" => "获取成功",  
  6.     "result" => [  
  7.        ["name"=>"zfeig","age"=>26,"address"=>"广州市天河区车陂天桥11号","study"=>["no"=>"0610832110","teacher"=>"李贤良"]],  
  8.        ["name"=>"lisi","age"=>27,"address"=>"四川省成都市高新区226号","study"=>["no"=>"0610832110","teacher"=>"何洁"]],  
  9.        ["name"=>"王大崔","age"=>25,"address"=>"浙江省杭州市西湖大道120号","study"=>["no"=>"0610732110","teacher"=>"刘德华"]],  
  10.        ["name"=>"刘晓花","age"=>23,"address"=>"福建省厦门市厦门大学路13号","study"=>["no"=>"0610632110","teacher"=>"王明"]],  
  11.        ["name"=>"lisi","age"=>27,"address"=>"四川省成都市高新区226号","study"=>["no"=>"0610832110","teacher"=>"何洁"]],  
  12.        ["name"=>"王大崔","age"=>25,"address"=>"浙江省杭州市西湖大道120号","study"=>["no"=>"0610732110","teacher"=>"刘德华"]],  
  13.        ["name"=>"刘晓花","age"=>23,"address"=>"福建省厦门市厦门大学路13号","study"=>["no"=>"0610632110","teacher"=>"王明"]]  
  14.     ]  
  15. ];  
  16.   
  17.   
  18. function encodeCN($result){  
  19.   
  20.     foreach ($result as $k => $v) {  
  21.         if(is_array($v)){  
  22.            $result[$k] = encodeCN($v);         
  23.         }else{  
  24.             $result[$k] = urlencode($v);  
  25.         }  
  26.     }  
  27.   
  28.     return $result;  
  29. }  
  30.   
  31. $result = encodeCN($result);  
  32.   
  33. echo urldecode(json_encode($result));  
  34.   
  35. ?>  

MainActivity.java


  1. package com.example.tes.api;  
  2. import android.app.Activity;  
  3. import android.app.ProgressDialog;  
  4. import android.content.Intent;  
  5. import android.os.Bundle;  
  6. import android.os.Handler;  
  7. import android.os.Message;  
  8. import android.view.View;  
  9. import android.widget.Button;  
  10. import android.widget.EditText;  
  11. import android.widget.ScrollView;  
  12. import android.widget.TextView;  
  13. import android.widget.Toast;  
  14.   
  15. public class MainActivity extends Activity implements View.OnClickListener {  
  16.      private static EditText text;  
  17.      private static Button btn;  
  18.      private static Button listBtn;  
  19.      private static TextView tv;  
  20.      private static String info;  
  21.      private static ProgressDialog pd;  
  22.      private final String ADDR = "http://192.168.145.162:8000/api.php";  
  23.     @Override  
  24.     protected void onCreate(Bundle savedInstanceState) {  
  25.         super.onCreate(savedInstanceState);  
  26.         setContentView(R.layout.activity_main);  
  27.         btn = (Button) findViewById(R.id.button);  
  28.         listBtn = (Button) findViewById(R.id.button2);  
  29.         tv = (TextView) findViewById(R.id.textView);  
  30.         text = (EditText) findViewById(R.id.editText);  
  31.         btn.setOnClickListener(this);  
  32.         listBtn.setOnClickListener(this);  
  33.     }  
  34.   
  35.     Handler hander = new Handler(){  
  36.         @Override  
  37.         public void handleMessage(Message msg) {  
  38.             if(msg.what  == 1){  
  39.                 pd.dismiss();  
  40.                 info  = msg.obj.toString();  
  41.                 tv.setText(info);  
  42.             }  
  43.         }  
  44.     };  
  45.   
  46.     @Override  
  47.     public void onClick(View v) {  
  48.   
  49.         switch (v.getId()){  
  50.             case R.id.button :  
  51.                  String id =text.getText().toString();  
  52.                 if(id.equals(null) || id.equals("")){  
  53.                     Toast.makeText(this,"请输入id号",Toast.LENGTH_LONG).show();  
  54.                 }else{  
  55.   
  56.                     pd = new ProgressDialog(MainActivity.this);  
  57.                     pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);  
  58.                     pd.setMessage("wait...");  
  59.                     pd.show();  
  60.   
  61.                     final String Id = id;  
  62.                     new Thread(){  
  63.                         @Override  
  64.                         public void run() {  
  65.                             String msg =  Util.httpPost(ADDR,Integer.parseInt(Id));  
  66.                             msg = Util.parseJson2String(msg);  
  67.                             Util.sendMsg(hander,new Message(),msg);  
  68.                         }  
  69.                     }.start();  
  70.                 }  
  71.                 break;  
  72.             case R.id.button2:  
  73.                 Intent it = new Intent(MainActivity.this,ListActivity.class);  
  74.                 startActivity(it);  
  75.                 break;  
  76.         }  
  77.     }  
  78.   
  79.   
  80.   
  81.   
  82. }  

ListActivity.java

  1. package com.example.tes.api;  
  2. import android.app.Activity;  
  3. import android.os.Bundle;  
  4. import android.os.Handler;  
  5. import android.os.Message;  
  6. import android.widget.ListView;  
  7. import android.widget.Toast;  
  8. import java.util.Iterator;  
  9. import java.util.List;  
  10. public class ListActivity extends Activity {  
  11.     private static String ADDR ="http://192.168.145.162:8000/api.php";  
  12.     private ListView lv;  
  13.     @Override  
  14.     protected void onCreate(Bundle savedInstanceState) {  
  15.         super.onCreate(savedInstanceState);  
  16.         setContentView(R.layout.activity_list);  
  17.         lv = (ListView) findViewById(R.id.listView);  
  18.         initData();  
  19.     }  
  20.     Handler hander = new Handler(){  
  21.         @Override  
  22.         public void handleMessage(Message msg) {  
  23.             if(msg.what  == 1){  
  24.                 List<Person> data = (List<Person>) msg.obj;  
  25.                 String info =  list2str(data);  
  26.                 Toast.makeText(ListActivity.this,"消息:"+info, Toast.LENGTH_LONG).show();  
  27.                 lv.setAdapter(new PersonAdapter(data,ListActivity.this,R.layout.item));  
  28.             }  
  29.         }  
  30.     };  
  31.     public  void initData(){  
  32.         new Thread(){  
  33.             @Override  
  34.             public void run() {  
  35.                 super.run();  
  36.                 String msg =  Util.httpPost(ADDR, 1);  
  37.                 List data = Util.parseJson2List(msg);  
  38.                 Util.sendMsg(hander, new Message(), data);  
  39.             }  
  40.         }.start();  
  41.     }  
  42.     public  String  list2str(List<Person> list){  
  43.         StringBuilder sb = new StringBuilder();  
  44.         Iterator it = list.iterator();  
  45.         while(it.hasNext()){  
  46.             Person pr = (Person) it.next();  
  47.             String name =pr.getName();  
  48.             int age =pr.getAge();  
  49.             String address = pr.getAddress();  
  50.             String no = pr.getNo();  
  51.             String teacher =pr.getTeacher();  
  52.             sb.append("姓名:"+name+" ");  
  53.             sb.append("年纪:"+age+" ");  
  54.             sb.append("地址:"+address+" ");  
  55.             sb.append("学号:"+no+"\n");  
  56.         }  
  57.         return sb.toString();  
  58.     }  
  59. }  

Person.java

  1. package com.example.tes.api;  
  2.   
  3. /**  
  4.  * Created by no1 on 2016/6/25.  
  5.  */  
  6. public class Person {  
  7.     private String name;  
  8.     private int age;  
  9.     private String address;  
  10.     private String no;  
  11.     private String teacher;  
  12.   
  13.     public Person(String name, int age, String address, String no, String teacher) {  
  14.         this.name = name;  
  15.         this.age = age;  
  16.         this.address = address;  
  17.         this.no = no;  
  18.         this.teacher = teacher;  
  19.     }  
  20.   
  21.     public String getName() {  
  22.         return name;  
  23.     }  
  24.   
  25.     public void setName(String name) {  
  26.         this.name = name;  
  27.     }  
  28.   
  29.     public int getAge() {  
  30.         return age;  
  31.     }  
  32.   
  33.     public void setAge(int age) {  
  34.         this.age = age;  
  35.     }  
  36.   
  37.     public String getAddress() {  
  38.         return address;  
  39.     }  
  40.   
  41.     public void setAddress(String address) {  
  42.         this.address = address;  
  43.     }  
  44.   
  45.     public String getNo() {  
  46.         return no;  
  47.     }  
  48.   
  49.     public void setNo(String no) {  
  50.         this.no = no;  
  51.     }  
  52.   
  53.     public String getTeacher() {  
  54.         return teacher;  
  55.     }  
  56.   
  57.     public void setTeacher(String teacher) {  
  58.         this.teacher = teacher;  
  59.     }  
  60. }  


PersonAdapter.java


  1. package com.example.tes.api;  
  2. import android.content.Context;  
  3. import android.view.LayoutInflater;  
  4. import android.view.View;  
  5. import android.view.ViewGroup;  
  6. import android.widget.BaseAdapter;  
  7. import android.widget.TextView;  
  8. import java.util.List;  
  9.   
  10. public class PersonAdapter extends BaseAdapter {  
  11.     private List<Person> data;  
  12.     private static Context context;  
  13.     private static int resoureId;  
  14.   
  15.     PersonAdapter(List<Person> data,Context context,int resoureId){  
  16.         this.context = context;  
  17.         this.data = data;  
  18.         this.resoureId = resoureId;  
  19.     }  
  20.   
  21.     @Override  
  22.     public int getCount() {  
  23.         return data.size();  
  24.     }  
  25.   
  26.     @Override  
  27.     public Object getItem(int position) {  
  28.         return  data.get(position);  
  29.     }  
  30.   
  31.     @Override  
  32.     public long getItemId(int position) {  
  33.         return position;  
  34.     }  
  35.   
  36.     @Override  
  37.     public View getView(int position, View convertView, ViewGroup parent) {  
  38.         ViewHolder viewHolder = null;  
  39.         Person person = data.get(position);  
  40.         if(convertView == null){  
  41.             convertView = LayoutInflater.from(context).inflate(resoureId,null);//找到lv布局  
  42.             viewHolder = new ViewHolder(convertView);//找到布局下面的组件并缓存起来  
  43.             convertView.setTag(viewHolder);//缓存组件对象  
  44.   
  45.         }else{  
  46.             viewHolder = (ViewHolder) convertView.getTag();//获取组件对象  
  47.         }  
  48.         //组件对象填充数据  
  49.         viewHolder.name.setText(person.getName());  
  50.         viewHolder.age.setText("年纪:"+person.getAge()+"");  
  51.         viewHolder.address.setText("家庭住址:"+person.getAddress());  
  52.         viewHolder.no.setText("学号:"+person.getNo());  
  53.         viewHolder.teacher.setText("班主任:"+person.getTeacher());  
  54.         return convertView;  
  55.     }  
  56.   
  57.     public  class ViewHolder{  
  58.         private TextView name;  
  59.         private TextView age;  
  60.         private TextView address;  
  61.         private TextView no;  
  62.         private TextView teacher;  
  63.         ViewHolder(View contentView){  
  64.             this.name = (TextView) contentView.findViewById(R.id.name);  
  65.             this.age = (TextView) contentView.findViewById(R.id.age);  
  66.             this.address = (TextView) contentView.findViewById(R.id.address);  
  67.             this.no = (TextView) contentView.findViewById(R.id.no);  
  68.             this.teacher = (TextView) contentView.findViewById(R.id.teacher);  
  69.         }  
  70.     }  
  71. }  


Util.java

  1. package com.example.tes.api;  
  2.   
  3. import android.os.Handler;  
  4. import android.os.Message;  
  5.   
  6. import org.json.JSONArray;  
  7. import org.json.JSONException;  
  8. import org.json.JSONObject;  
  9.   
  10. import java.io.BufferedReader;  
  11. import java.io.IOException;  
  12. import java.io.InputStreamReader;  
  13. import java.net.HttpURLConnection;  
  14. import java.net.MalformedURLException;  
  15. import java.net.URL;  
  16. import java.util.ArrayList;  
  17. import java.util.List;  
  18.   
  19. public class Util {  
  20.     /**  
  21.      * @发送消息到消息队列中  
  22.      * @param hander  
  23.      * @param msg  
  24.      * @param data  
  25.      */  
  26.     public static void sendMsg(Handler hander,Message msg,String data){  
  27.         msg.what =1;  
  28.         msg.obj = data;  
  29.         hander.sendMessage(msg);  
  30.     }  
  31.     /**  
  32.      * @发送消息到消息队列中  
  33.      * @param hander  
  34.      * @param msg  
  35.      * @param data  
  36.      */  
  37.     public static void sendMsg(Handler hander,Message msg,List data){  
  38.         msg.what =1;  
  39.         msg.obj = data;  
  40.         hander.sendMessage(msg);  
  41.     }  
  42.   
  43.     /**  
  44.      * @获取post请求  
  45.      * @param url  
  46.      * @param id  
  47.      * @return  
  48.      */  
  49.     public static String httpPost(String url,int id){  
  50.         String params = "act=1";  
  51.         params = params +"&vid="+id;  
  52.         String data = null;  
  53.         HttpURLConnection conn = null;  
  54.         try{  
  55.             //get request  
  56.             URL address = new URL(url);  
  57.             conn = (HttpURLConnection) address.openConnection();  
  58.             conn.setRequestMethod("POST");  
  59.             conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded");  
  60.             conn.setRequestProperty("Content-Length", String.valueOf(params.getBytes().length));  
  61.             conn.setDoInput(true);  
  62.             conn.setDoOutput(true);  
  63.             conn.getOutputStream().write(params.getBytes());//将参数写入输出流  
  64.             //get outinput  
  65.             StringBuilder sb = new StringBuilder();  
  66.             BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));  
  67.             String msg = "";  
  68.             while((msg = br.readLine())!=null){  
  69.                 sb.append(msg);  
  70.             }  
  71.             data = sb.toString();  
  72.         } catch (MalformedURLException e) {  
  73.             e.printStackTrace();  
  74.         } catch (IOException e) {  
  75.             e.printStackTrace();  
  76.         }finally {  
  77.             if(conn != null){  
  78.                 conn.disconnect();  
  79.             }  
  80.         }  
  81.         System.out.println("获取结果为:" + data);  
  82.         return data;  
  83.     }  
  84.   
  85.     /**  
  86.      * @get请求  
  87.      * @param url  
  88.      * @return  
  89.      */  
  90.     public static String httpGet(String url){  
  91.         String data = null;  
  92.         HttpURLConnection conn = null;  
  93.         try{  
  94.             URL address = new URL(url);  
  95.             conn = (HttpURLConnection) address.openConnection();  
  96.             conn.setRequestMethod("GET");  
  97.             conn.setDoInput(true);  
  98.             StringBuilder sb = new StringBuilder();  
  99.             BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));  
  100.             String msg = "";  
  101.             while((msg = br.readLine())!=null){  
  102.                 sb.append(msg);  
  103.             }  
  104.             data = sb.toString();  
  105.         } catch (MalformedURLException e) {  
  106.             e.printStackTrace();  
  107.         } catch (IOException e) {  
  108.             e.printStackTrace();  
  109.         }finally {  
  110.             if(conn != null){  
  111.                 conn.disconnect();  
  112.             }  
  113.         }  
  114.         return data;  
  115.     }  
  116.   
  117.     /**  
  118.      * @解析json存为字符串  
  119.      * @param data  
  120.      * @return  
  121.      */  
  122.     public static String  parseJson2String(String data){  
  123.         String result = "";  
  124.         try{  
  125.             JSONObject object = new JSONObject(data);  
  126.             int status  = object.getInt("status");  
  127.             if(status == 200){  
  128.                 JSONArray item = object.getJSONArray("result");  
  129.               for(int i=0;i<item.length();i++){  
  130.                   JSONObject tmpObj = item.getJSONObject(i);  
  131.                   String name = tmpObj.getString("name");  
  132.                   int age = tmpObj.getInt("age");  
  133.                   String address = tmpObj.getString("address");  
  134.                   JSONObject study = tmpObj.getJSONObject("study");  
  135.                   String no = study.getString("no");  
  136.                   String teacher = study.getString("teacher");  
  137.                   result += "姓名:"+name+" 年纪:"+age+" 地址:"+address+" 学号:"+no+" 老师:"+teacher+"\n";  
  138.               }  
  139.   
  140.             }else{  
  141.                 result = "获取结果失败!";  
  142.             }  
  143.         } catch (JSONException e) {  
  144.             e.printStackTrace();  
  145.         }  
  146.         return result;  
  147.     }  
  148.   
  149.     /**  
  150.      * @解析json存储为集合  
  151.      * @param data  
  152.      * @return  
  153.      */  
  154.     public static List<Person> parseJson2List(String data){  
  155.        List<Person> result = new ArrayList<Person>();  
  156.         try{  
  157.             JSONObject object = new JSONObject(data);  
  158.             int status  = object.getInt("status");  
  159.             if(status == 200){  
  160.                 JSONArray item = object.getJSONArray("result");  
  161.                 for(int i=0;i<item.length();i++){  
  162.                     JSONObject tmpObj = item.getJSONObject(i);  
  163.                     String name = tmpObj.getString("name");  
  164.                     int age = tmpObj.getInt("age");  
  165.                     String address = tmpObj.getString("address");  
  166.                     JSONObject study = tmpObj.getJSONObject("study");  
  167.                     String no = study.getString("no");  
  168.                     String teacher = study.getString("teacher");  
  169.                     Person person = new Person(name,age,address,no,teacher);  
  170.                     result.add(person);  
  171.                 }  
  172.   
  173.             }else{  
  174.                 System.out.println("获取失败或无数据!");  
  175.             }  
  176.         } catch (JSONException e) {  
  177.             e.printStackTrace();  
  178.         }  
  179.         return result;  
  180.     }  
  181. }  


布局文件:

activity_main.xml

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas./apk/res/android"  
  3.     android:orientation="vertical" android:layout_width="match_parent"  
  4.     android:layout_height="match_parent"  
  5.     android:weightSum="1">  
  6.     <EditText  
  7.         android:layout_width="match_parent"  
  8.         android:layout_height="wrap_content"  
  9.         android:hint="请输入id"  
  10.         android:id="@+id/editText"  
  11.         android:layout_gravity="center_horizontal" />  
  12.   
  13.     <LinearLayout xmlns:android="http://schemas./apk/res/android"  
  14.         android:orientation="horizontal"  
  15.         android:layout_width="match_parent"  
  16.         android:layout_height="wrap_content"  
  17.         android:layout_marginTop="5dip"  
  18.         android:layout_marginBottom="5dip">  
  19.         <Button  
  20.             android:layout_width="wrap_content"  
  21.             android:layout_height="wrap_content"  
  22.             android:layout_marginTop="20dip"  
  23.             android:layout_marginBottom="20dip"  
  24.             android:text="查询"  
  25.             android:layout_weight="1"  
  26.             android:id="@+id/button" />  
  27.   
  28.         <Button  
  29.             android:layout_width="wrap_content"  
  30.             android:layout_height="wrap_content"  
  31.             android:layout_marginTop="20dip"  
  32.             android:layout_marginBottom="20dip"  
  33.             android:text="数据列表"  
  34.             android:layout_weight="1"  
  35.             android:id="@+id/button2" />  
  36.   
  37.     </LinearLayout>  
  38.   
  39.   
  40.     <ScrollView  
  41.         android:layout_width="match_parent"  
  42.         android:layout_height="match_parent"  
  43.         android:id="@+id/scrollView"  
  44.         android:layout_gravity="center_horizontal" >  
  45.         <TextView  
  46.             android:layout_width="match_parent"  
  47.             android:layout_marginTop="20dip"  
  48.             android:layout_height="wrap_content"  
  49.             android:textAppearance="?android:attr/textAppearanceLarge"  
  50.             android:text=""  
  51.             android:scrollbars="vertical"  
  52.             android:hint="显示结果"  
  53.             android:id="@+id/textView" />  
  54.     </ScrollView>  
  55. </LinearLayout>  


activity_list.xml

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas./apk/res/android"  
  3.     android:orientation="vertical" android:layout_width="match_parent"  
  4.     android:layout_height="match_parent">  
  5.   
  6.     <TextView  
  7.         android:layout_width="wrap_content"  
  8.         android:layout_height="wrap_content"  
  9.         android:textAppearance="?android:attr/textAppearanceSmall"  
  10.         android:text="学生通讯录"  
  11.        android:textColor="#D50203"  
  12.         android:textSize="30dip"  
  13.         android:layout_gravity="center"  
  14.         android:layout_marginBottom="10dip"  
  15.         android:id="@+id/textView2" />  
  16.   
  17.     <ListView  
  18.         android:layout_width="match_parent"  
  19.         android:layout_height="wrap_content"  
  20.         android:id="@+id/listView"  
  21.         android:layout_gravity="center_horizontal" />  
  22. </LinearLayout>  

item.xml

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas./apk/res/android"  
  3.     android:orientation="vertical" android:layout_width="match_parent"  
  4.     android:layout_height="match_parent">  
  5.   
  6.     <TextView  
  7.         android:layout_width="wrap_content"  
  8.         android:layout_height="wrap_content"  
  9.         android:textAppearance="?android:attr/textAppearanceSmall"  
  10.         android:text="Small Text"  
  11.         android:id="@+id/name" />  
  12.   
  13.     <TextView  
  14.         android:layout_width="wrap_content"  
  15.         android:layout_height="wrap_content"  
  16.         android:textAppearance="?android:attr/textAppearanceSmall"  
  17.         android:text="Small Text"  
  18.         android:id="@+id/age" />  
  19.   
  20.     <TextView  
  21.         android:layout_width="wrap_content"  
  22.         android:layout_height="wrap_content"  
  23.         android:textAppearance="?android:attr/textAppearanceSmall"  
  24.         android:text="Small Text"  
  25.         android:id="@+id/address" />  
  26.   
  27.     <TextView  
  28.         android:layout_width="wrap_content"  
  29.         android:layout_height="wrap_content"  
  30.         android:textAppearance="?android:attr/textAppearanceSmall"  
  31.         android:text="Small Text"  
  32.         android:id="@+id/no" />  
  33.   
  34.     <TextView  
  35.         android:layout_width="wrap_content"  
  36.         android:layout_height="wrap_content"  
  37.         android:textAppearance="?android:attr/textAppearanceSmall"  
  38.         android:text="Small Text"  
  39.         android:id="@+id/teacher" />  
  40. </LinearLayout>  




    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多