酷派天气学习笔记(三)(遍历省市县数据)

这篇博客记录了在酷派天气应用中创建choose_area.xml布局文件,并编写遍历省市县数据的碎片代码的过程。
摘要由CSDN通过智能技术生成

在res/layout目录中新建choose_area.xml
代码如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:background="#fff "  >
    <RelativeLayout
        android:layout_height="?attr/actionBarSize"
        android:layout_width="match_parent"
        android:background="?attr/colorPrimary">
    <TextView
        android:id="@+id/title_text"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:textSize="20sp"
        android:textColor="#fff"
        android:layout_centerInParent="true" />
    <Button
        android:id="@+id/back_button"
        android:layout_height="25dp"
        android:layout_width="25dp"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="10dp"
        />
</RelativeLayout>
    <ListView
        android:id="@+id/list_view"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>
</LinearLayout>

接下来关键的一步,我们需要编写用于遍历省市县数据的碎片
代码如下

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.dong.myapplication.Util.HttpUtil;
import com.example.dong.myapplication.Util.Utility;
import com.example.dong.myapplication.db.City;
import com.example.dong.myapplic
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值