当前位置:   article > 正文

Android studio ListView应用设计_android studio用listview编写页面

android studio用listview编写页面

一、添加ListView控件:

<ListView
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:layout_editor_absoluteX="1dp" />

二、类文件Country.java:

  1. package com.july.listviewapp;
  2. public class Country {
  3. private String name;
  4. private int icon;
  5. public Country(String name,int icon){
  6. this.name = name;
  7. this.icon = icon;
  8. }
  9. public String getName(){
  10. return name;
  11. }
  12. public void setName(String name){
  13. this.name = name;
  14. }
  15. public int getIcon(){
  16. return icon;
  17. }
  18. public void setIcon(int icon){
  19. this.icon = icon;
  20. }
  21. }

三、子布局文件:

<?xml version="1.0" encoding
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/704565
推荐阅读
相关标签
  

闽ICP备14008679号