Android:ListView链接几个列表

时间:2011-02-11 15:56:43

标签: android listview

我想在ListView上链接许多List。 第一份清单:美国,欧盟,亚洲,非洲...... 然后,当我点击美国它应该来第二个列表:弗吉尼亚州,北卡罗来纳州,俄亥俄州...... 点击弗吉尼亚第三名单:弗吉尼亚海滩,诺福克,切萨皮克...... 最后,点击第三个列表,最后应该在WebView上创建 html Page 。谢谢!

1 个答案:

答案 0 :(得分:0)

我的意思是,当我点击 USA 时,下一个List(usa [])会出现,而 Virginia 应该出现下一个List(virginia [])。< / p>

public class customlistview扩展了ListActivity {     私人ListView lv1;

private String continent[] = {
        "USA", "EU", "Asia", "Afrika", "Australia"
};
private String usa[] = {
        "Alabama", "Virginia", "Arizona", "Arkansas",
        "California", "Florida", "Kansas", "Indiana",
        "Michigan", "Ohio", "New York", "North Carolina"
};
private String virginia[] = {
        "Virginia Beach", "Norfolk", "Chesapeake",
        "Richmond", "Hampton", "Arlington"
};

@Override  
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);  
    setContentView(R.layout.main);

    lv1=(ListView)findViewById(R.id.ListView01);

    lv1.setAdapter(new ArrayAdapter<String>
    (this,android.R.layout.simple_list_item_1 , continent));


    lv1.setOnItemClickListener(new OnItemClickListener() {

    @Override
    public void onItemClick(AdapterView<?> arg0, View arg1,
    int arg2, long arg3) {

        // TODO

    }
}       

}