1.创建程序xinwenkehuduan
a.布局文件如下所示:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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:orientation="vertical" tools:context="com.example.bz0209.xinwenkehuduan.MainActivity"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/loading" android:visibility="invisible" android:gravity="center" android:orientation="vertical"> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="正在加载信息......" /> </LinearLayout> <ListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/lv_news"> </ListView> </FrameLayout> </LinearLayout>
b.界面如下1-1所示:
1-1 1-2
2.创建ListView Item的布局:
a.ListView的Item布局文件如下所示:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android<