Making a view in a listview invisible android
问题:
I have a ListView that's using a custom adapter. I want to dynamically add/remove items from the ListView. I've tried everything inside the getView() method in my view adapter. I've tried doing setVisiblity(View.GONE) on the view I'm returning. And it in fact doesn't draw the view, but it still allocates space for the view and it's just a blank black space.
Is this even possible to set items in ListView invisible?
回复:
You need to call setVisiblity(View.GONE) on the returned view and all the views inside it. If you are reusing the convert view passed in you need to remember to call setVisiblity(View.VISIBLE) on all the views you want visible.
If you have a lot of invisible views you may need to set the divider height to 0 and add your own divider to the returned views. Otherwise the 'invisible' views will each have a visible divider and produce a noticeable gray line between visible views.
结论:
1) 将View控件设置成不可视。
2) 将View内部的控件设置不可视。
3) 在xml布局文件将ListView分隔条高度置为0,采用自定义的分隔条。
4) 将View内部的分隔条设置不可视。
5) 第一行分隔条不可视。
Making a view in a listview invisible android的更多相关文章
- Android_(控件)使用ListView显示Android系统SD卡的文件列表_02
使用ListView显示Android SD卡中的文件列表 父类布局activity_main.xml,子类布局item_filelayout(一个文件的单独存放) 运行截图: 程序结构 <?x ...
- Android_(控件)使用ListView显示Android系统中SD卡的文件列表
使用ListView显示Android SD卡中的文件列表 父类布局activity_main.xml,子类布局line.xml(一个文件的单独存放) 运行截图: 程序结构: <?xml ver ...
- 让 ListView 在 Android 可回弹
说明:让 ListView 在 Android 可回弹. 适用:Delphi XE5 修改:找出 FMX.Platform.Android.pas 档案,并复制到自己的 Project 路径里,找到 ...
- android中View的GONE和INVISIBLE的原理
废话只重复两句: GONE真的隐藏: INVISIBLE不可见但是预留了View的位置: 网上千篇一律的重复着这两句话并举着例子,并没有观察本质来作区分.查看源码后得知其区别希望广大朋友能够借鉴,源码 ...
- Android_(控件)使用ListView显示Android系统中联系人信息
使用ListView显示手机中联系人的姓名和电话号码 父类布局activity_main.xml,子类布局line.xml(一个文件的单独存放) 运行截图: (避免泄露信息对部分地方进行了涂鸦O(∩_ ...
- no drawer view found with gravity RIGHT(Android实现侧滑菜单从右面滑出) 解决办法
代码如下: <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width ...
- 我的Android进阶之旅------>ListView中android:cacheColorHint,android:listSelector属性作用 .
( 本文转载于:http://blog.csdn.net/stonecao/article/details/6216449) 自定义listview的时候,当你不使用android:cacheColo ...
- delphi xe6 让 ListView 在 Android 可回弹[根据龟山阿卍原创修改为xe6版本]
Delphi XE6 找出 FMX.Platform.Android.pas 档案,并复制到自己的 Project 路径里,找到 GetScrollingBehaviour 函数,修改成如下: uni ...
- Android中View的事件分发机制——Android开发艺术探索笔记
原文链接 http://sparkyuan.me/ 转载请注明出处 介绍 点击事件的事件分发就是对MotionEvent事件的分发过程.当一个MotionEvent产生了以后,系统须要把这个事件传递给 ...
随机推荐
- Java基础七(Eclipse工具)
今日内容介绍1.Eclipse开发工具2.超市库存管理系统 ###01Eclipse的下载安装 * A: Eclipse的下载安装 * a: 下载 * http://www.eclipse.org ...
- Windows和linux 文件互传
一般我是直接在windows下创建一个共享文件夹,然后在linux挂载,我一直都是这么干的. 直到有一天,我需要往一个公网linux上面传几个文件,可是我的Windows是内网的,所以,这种方法行不通 ...
- idea使用的JDK版本1.9换成1.8后相关的更改设置
File——>Project Structure 一.查看Project中的jdk 1.检查Project SDK:中jdk 版本是否为1.8版本 2.检查Project language le ...
- 填充整个区间(fill,fill_n,generate和generate_n)
fill 将value值填充整个区间,不能为OutputIterator,因为fill会用到first和last,outputIterator无法做相等的测试 template <class F ...
- lua C++ wrapper
背景 最近在研究lua的c++绑定库,使用过一下几个 luabind 问题:没人维护 https://github.com/vinniefalco/LuaBridge https://github.c ...
- 设置Redis最大占用内存
https://blog.csdn.net/happyrabbit456/article/details/54945667 Redis需要设置最大占用内存吗?如果Redis内存使用超出了设置的最大值会 ...
- 弱网测试—Network-Emulator-Toolkit工具
参考别人网址:http://blog.csdn.net/no1mwb/article/details/53638681 弱网测试,属于健壮性测试:怎么样去做弱网测试呢? 一.安装弱网测试工具-Netw ...
- 根据IP和端口号异步短时间判断服务器是否链接
/// <summary> /// 短时间判断是否可以连接 /// </summary> /// <param name="ipe"></ ...
- JMeter ----与WebDriver安装与测试
JMeter ----与WebDriver安装与测试 主要内容 JMeter安装 WebDriver安装 一个简单的JMeter+WebDriver示例 环境与参考 jvm版本: 1.8.0_65 j ...
- Redis:五种数据类型的简单增删改查
Redis简单增删改查例子 例一:字符串的增删改查 #增加一个key为ay_key的值 127.0.0.1:6379> set ay_key "ay" OK #查询ay_ke ...