当前位置:操作系统 > 安卓/Android >>

Android+Listview+分页+动态加载网络数据

最近搞Android动态加载网络数据总结点心得:

list_item.xml代码如下:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
              android:layout_width="fill_parent" 
              android:layout_height="fill_parent" 
              android:orientation="horizontal"> 
           
<LinearLayout 
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent" 
  android:orientation="vertical"> 
  <TextView 
     android:id="@+id/Gds_Name" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textSize="20px" 
     /> 
     
  <TextView 
     android:id="@+id/Gds_Code" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"/> 
</LinearLayout> 
</LinearLayout> 
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="horizontal">
         
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical">
  <TextView
     android:id="@+id/Gds_Name"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:textSize="20px"
     />
   
  <TextView
     android:id="@+id/Gds_Code"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
 
显示加载更多的布局代码loadmore.xml如下:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent"> 
  <Button   
      android:id="@+id/loadMoreButton"   
      android:layout_width="fill_parent"   
      android:layout_height="wrap_content" 
      android:text="查看更多..." />  
</LinearLayout> 
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <Button 
      android:id="@+id/loadMoreButton" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:text="查看更多..." />
</LinearLayout>
 

商品类Goods.java的代码如下:

package com.jemsn.util; 
 
public class Goods { 
    private String Goods_ID; 
    private String Gds_Code; 
    private String Gds_Name; 
    private String Gds_BarCode; 
    private String Gds_Unit; 
    private Double Gds_Ref; 
    private String Gds_Price; 
    private String Gds_PUnit; 
    private String Gds_ClassID; 
    private String Gds_GdsPY; 
 
    public String getGoods_ID() { 
        return Goods_ID; 
    } 
 
    public void setGoods_ID(String goods_ID) { 
        Goods_ID = goods_ID; 
    } 
 
    public String getGds_Code() { 
        return Gds_Code; 
    } 
 
    public void setGds_Code(String gds_Code) { 
        Gds_Code = gds_Code; 
    } 
 
    public String getGds_Name() { 
        return Gds_Name; 
    } 
 
    public void setGds_Name(String gds_Name) { 
        Gds_Name = gds_Name; 
    } 
 
    public String getGds_BarCode() { 
        return Gds_BarCode; 
    } 
 
    public void setGds_BarCode(String gds_BarCode) { 
        Gds_BarCode = gds_BarCode; 
    } 
 
    public String getGds_Unit() { 
        return Gds_Unit; 
    } 
 
    public void setGds_Unit(String gds_Unit) { 
        Gds_Unit = gds_Unit; 
    } 
 
    public Double getGds_Ref() { 
        return Gds_Ref; 
    } 
 
    public void setGds_Ref(Double gds_Ref) { 
        Gds_Ref = gds_Ref;&n

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,