当前位置: 首页 > news >正文

杭州做网站seo小广告图片

杭州做网站seo,小广告图片,大概多少钱,移商网站建设前言 前面在适配器章节&#xff0c;已经介绍了ListView的作用(干什么的)&#xff0c;这节将主要介绍如何去设计ListView页面视图。 思考 列表视图需要些什么&#xff1f; 1. 列表项容器&#xff08;装载各列表项的容器&#xff09;&#xff1a;<ListView/> 2. 列表项布局…

前言

前面在适配器章节,已经介绍了ListView的作用(干什么的),这节将主要介绍如何去设计ListView页面视图。

思考

 列表视图需要些什么?

1. 列表项容器(装载各列表项的容器):<ListView/>

2. 列表项布局:my_list_item.xml

3. 列表所需数据:List<Object>、Adapter(桥梁)

 代码示例

下面的代码示例,是从我的项目中copy的是一个很好的例子

 

// 1. 列表项容器:activity_charge_up.xml(仅展示了相关部分)
<ListViewandroid:id="@+id/cuisine_list"android:layout_width="match_parent"android:layout_height="match_parent">
</ListView>// 2. 列表项布局:cuisine_list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="60dp"android:background="#FEFCEB"android:layout_margin="10dp"><TextViewandroid:id="@+id/cuisineName"android:layout_width="75dp"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="20dp"android:text="西红柿炒鸡蛋"android:textColor="@color/black"android:textSize="12sp"></TextView><TextViewandroid:id="@+id/cuisinePrice"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="5dp"android:layout_toRightOf="@+id/cuisineName"android:text="¥99.90"android:textColor="#FF1100"android:textSize="12sp"android:textStyle="bold"></TextView><Buttonandroid:id="@+id/subCuisine"android:layout_width="30dp"android:layout_height="30dp"android:layout_centerVertical="true"android:layout_toLeftOf="@+id/cuisineQuantity"android:textSize="5dp"android:background="@drawable/sub"></Button><TextViewandroid:id="@+id/cuisineQuantity"android:layout_width="20dp"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toLeftOf="@+id/addCuisine"android:gravity="center"android:text="0"android:textColor="@color/black"android:textSize="10dp"></TextView><Buttonandroid:id="@+id/addCuisine"android:layout_width="30dp"android:layout_height="30dp"android:background="@drawable/add"android:layout_alignParentRight="true"android:layout_centerVertical="true"android:textSize="5sp"></Button></RelativeLayout>
</RelativeLayout>

适配器的使用很简单:

MyAdapter myAdapter = new MyAdapter(参数); 
ListView cuisineList = findById(R.layout.cuisine_list);
cuisineList.setAdapter(myAdapter);

复杂的是适配器的业务逻辑(适配器的实现):

    对于适配器的实现,可以参考前面适配器章节,这里就不再做具体的代码示例。

    在实际需求中,在适配器中你可能需要接受多个参数,你需要处理列表项的交互(譬如点击),你可能也需要即时地去改变列表项所在页面的相关控件内容(因为修改列表项一般也需要修改其他页面元素)。

 导航栏

其实学习ListView后,当想到设计导航栏后,可能会想到它能否胜任导航栏的设计呢?

        并不好去设计。首先,导航栏不仅有竖直的,还有水平的;其二,导航栏不仅仅是导航栏的变化,更涉及到导航内容的变化。

        所以导航栏的设计,一般有以下两种策略:

        (1) 自己设计:导航(LinearLayout)、导航页面内容(removeAllViews+addView+LayoutInflater)

        (2) 可用控件FragmentViewPager(参考链接:Android四种底部导航栏实现)

后言

 下一节,将介绍RecyclerView的相关知识

http://www.tj-hxxt.cn/news/91756.html

相关文章:

  • 品牌推广软文200字seo zac
  • 网站推广软件下拉管家大数据营销系统软件
  • 好的网站建设公司哪家好百度收录提交入口网址
  • 看谁做的好舞蹈视频网站太原seo排名公司
  • 江西省城乡建设厅网站沈阳seo排名优化软件
  • 用织梦做的网站 图片打开很慢网络舆情管理
  • 网站开发工资高嘛常用的搜索引擎
  • 怎么创建一个网站卖东西百度移动权重
  • 用织梦做的政府网站网站数据统计工具
  • 做网站有er图seo推广培训资料
  • 藁城住房和城乡建设局网站起名最好的网站排名
  • 凡科建网站深圳营销型网站
  • 建个网站视频网络营销推广策略
  • 阅读转发网站那些做的比较好天津网站建设技术外包
  • 朔州网站建设电话建网站的公司
  • flash 好的网站百度快照收录
  • 香港 网站建设 可视化网站程序百度竞价优化排名
  • 网站搭建后如何使用电商培训机构有哪些?哪家比较好
  • 怎么做市场推广四川seo多少钱
  • 四川个人网站备案抖音seo什么意思
  • 信阳市人民政府网站官网自己的网站怎么在百度上面推广
  • 亚马逊网上购物商城seo综合查询工具下载
  • 可以做软件的网站有哪些功能吗近期国际热点大事件
  • 中建招标平台叫什么网seo站内优化最主要的是什么
  • 网站建设排版规定防城港网站seo
  • 做家政服务网站宁波网站推广联系方式
  • 苏州有哪些做网站dz论坛seo
  • 为个人网站做微信服务号seo新手教程
  • wordpress搭建个人网站百度号码认证平台个人号码申诉
  • 开通网站需要什么手续如何查看百度指数