android 设计一个可单选,多选的demo -欧洲杯足彩官网

`
wuhua
  • 浏览: 2090660 次
  • 性别:
  • 来自: 广州
博主相关
  • 博客
  • 微博
  • 相册
  • 收藏
  • 社区版块
    • ( 84)
    • ( 634)
    • ( 15)
    存档分类
    最新评论

    android 设计一个可单选,多选的demo

    android 提供了相当多的ui,在android.widget 的ui组件库,下面就让我们看看他是listview的用法吧。

     

    下面的demo 是一个

     

    /*
     * 欧洲杯足彩官网 copyright (c) 2008 google inc.
     *
     * licensed under the apache license, version 2.0 (the "license");
     * you may not use this file except in compliance with the license.
     * you may obtain a copy of the license at
     *
     *      http://www.apache.org/licenses/license-2.0
     *
     * unless required by applicable law or agreed to in writing, software
     * distributed under the license is distributed on an "as is" basis,
     * without warranties or conditions of any kind, either express or implied.
     * see the license for the specific language governing permissions and
     * limitations under the license.
     */
    package com.example.android.apis.view;
    import android.app.listactivity;
    import android.os.bundle;
    import android.widget.arrayadapter;
    import android.widget.listview;
    /**
     * this example shows how to use choice mode on a list. this list is 
     * in choice_mode_single mode, which means the items behave like
     * checkboxes.
     */
    public class list10 extends listactivity {
        @override
        public void oncreate(bundle savedinstancestate) {
            super.oncreate(savedinstancestate);
            setlistadapter(new arrayadapter(this,
                    android.r.layout.simple_list_item_single_choice, genres));
            final listview listview = getlistview();
            listview.setitemscanfocus(false);
            listview.setchoicemode(listview.choice_mode_single);
        }
        private static final string[] genres = new string[] {
            "action", "adventure", "animation", "children", "comedy", "documentary", "drama",
            "foreign", "history", "independent", "romance", "sci-fi", "television", "thriller"
        };
    

     

    上面是一个单选的list demo。

     

    对于需要多选的话可以改变这些参数就ok了

     

     

    setlistadapter(new arrayadapter(this,
                    android.r.layout.simple_list_item_multiple_choice, genres));
            final listview listview = getlistview();
            listview.setitemscanfocus(false);
            listview.setchoicemode(listview.choice_mode_multiple);
    

    很简单吧,android的开发确实很不错。

     

     

     

    2
    3
    分享到:
    |
    评论
    3 楼 cnliuyix 2012-04-08  
    lz搞点更有层次的吧,介个一般工程里根本用不到这么简单的。simplecursoradapter加simple_list_item_multichoice再自定义的listitem layout,最后有个listener,这多有意义啊
    2 楼 2009-09-05  
    知道了,checkedtextview
    1 楼 2009-09-05  
    如果不用android.r.layout.simple_list_item_multiple_choice
    怎么实现?

    暂时没有android.r.layout.simple_list_item_multiple_choice源码

    相关推荐

      android 树形结构开发demo,实现单选多选功能

      listview 实现单选/多选的demo例子,欢迎指正

      简单明了的实现了购物车中的单选和多选,可根据自身情况自己设定。

      listview多选与单选模式demo 可以进行单选和多选模式切换,一个小demo,请多多指教。

      类似于购买商品弹窗选择商品类型颜色、大小、规格等等,使用popwindow仿照淘宝京东的侧滑单选多选效果

      android高级应用源码-仿ios的圆角设置界面。直接可用,单选多选等atable_demo(ios风格设置).zip

      android问卷或试题demo,支持单项、多选、判断,代码清晰简单。

      android 图片单选_多选、拍照、裁剪、压缩。视频选择和录制demo

      android应用源码开发demo,主要用于毕业设计学习。

      源码参考,欢迎下载

      仿ios的圆角设置界面。直接可用,单选多选等atable_demo(ios风格设置) [注:本内容来自网络,在此分享仅为帮助有需要的网友,如果侵犯了您的权利,麻烦联系我,我会第一时间删除,谢谢您。]

      android 拍照、图库多选图上传 实现了拍照保存图片,图库单选,图库多选以及数据上传的功能,代码中有详细注释,图片多选在网上找过很多,一个多选功能动辄十几个文件,集成到项目中文件太多太乱,所以抽时间边学边...

      包括一个全局的全选按钮,每一项的全选按钮,单选按钮。实现类似淘宝购物车选中功能

      android expandablelistview 实现购物车页面 全选 多选 单选 编辑删除

      若无法下载demo,可以在qq交流群的群文件下载,文件名为demo-release,下载最新的即可。 无选中状态(默认ui色调) 选中状态( ) 其他功能(各功能可自选) 专辑列表(默认ui色调) 相册带广告( ) 专辑列表带...

      包含所有常用控件使用 androidalarm:广播broadcase 服务service,活动activity ...对话框:多按钮,列表、单选、多选、进度、读取中、自定义 tost:自定义,带图、线程 gridview: widget notificatin test: 翻页效果:

      android-listview该demo实现了listview嵌套listview并还有checkbox全选反选单选的实类似淘宝购物车功能

      android仿ios的圆角设置界面 直接可用 单选多选等atable demo ios风格设置

      android 经量级选择图片框架,支持拍照,获取相册图片,获取本地视频,可以多选,单选 声明 此框架功能点有: 新增对图片列表展示的个数; 将图片的加载框架默认不处理,需要自己去实现iengine接口来实现图片加载,...

      android单选复选按钮数据库综合实例spinnerdialogdemo 本示例说明: 1.实现单选按钮与后台数据绑定,通过id绑定. 2.实现显示时默认选中项控制. 3.实现修改后保存,根据id保存. 4.数据库处理使用ahibernate1.1,详见:...

    global site tag (gtag.js) - google analytics
    网站地图