ListView详解

热度1已有 1232 次阅读2012-3-12 18:58|个人分类:Android|android,背景色,Android

1、 android ListView详解 http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html 2、Android中ListView的性能问题 http://android.tgbus.com/Android/tutorial/201105/354459.shtml 3、设置背景色为透明,防止滑动时,背景变黑 android:cacheColorHint="#00000000" 4、设置ListView控件条目被按下时背景颜色在文字背后,设置成True时背景色会覆盖文字 android:drawSelectorOnTop="false" 5、android:divider属性:本属性设置listView中的选项分隔符,可设置图片,颜色等。 android:divider="#00000000" 设置为无色,这样显示时,就没有分隔线了。 6、android:minHeight="?android:attr/listPreferredItemHeight" 设置最小高度由item决定 7、Listview更新: 在BaseAdapter的getView()方法中根据条件改变View的字体颜色、其中的图片等,是不能立即在UI上显示的,必须调用notifyDataSetChanged()方法,实现更新。 ListView不能局部更新( 现在为止我没找到实现局部更新的方法,如有同学有方法实现局部更新,盼赐教。),更新实现如下: BaseAdapter adapter =new BaseAdapter(); adapter.notifyDataSetChanged(); 8、更改ListView中选中框的TextView的字体颜色: 要改变TextView的颜色,需调用TextView的setTextColor()方法设置,在使用中发现,在BaseAdapter中的getView()中使用“name.setTextColor(R.color.background);”方式字体会是黑色,可用”name.setTextColor(Color.rgb(0, 234, 255));“方式改变字体颜色,“Color.rgb(0, 234, 255)”为要设置的颜色的RGB值;最后在OnItemSelectedListener的onItemSelected()方法中调用”adapter.notifyDataSetChanged();“方法即可。 虽然这种方式可以改变字体颜色,但不知道为什么?盼有知道的同学解惑。 9、可扩展的ListView:ExpandableListView ExpandableListView为ListView子类,

更多相关文章

  1. 浅谈Java中Collections.sort对List排序的两种方法
  2. Python list sort方法的具体使用
  3. python list.sort()根据多个关键字排序的方法实现
  4. Android(安卓)ImageView图片自适应
  5. [Android]Android(安卓)颜色大全 colors.xml
  6. TextView 的设置现实的文字的长度?
  7. Android(安卓)Studio 更新时提示connection failed的解決方法
  8. android:configChanges="orientation|keyboardHidden"的使用
  9. Android(安卓)视频播放

随机推荐

  1. 快速理解android View的测量onMeasure()
  2. Android面试整理(2016)
  3. android中LayoutInflater的使用
  4. android sqlite的增删改查
  5. android的UI系统分析
  6. ArcGIS Runtime for Android 使用异步GP
  7. Android横竖屏切换的解决方法
  8. Andrioid SystemProperties和Settings.Sy
  9. 【Android】Replace "..." with ellipsis
  10. android引入JAR包,打包成JAR包,打包成Libra