listView 中relativeLayout 布局的 android:layout_alignParentBottom="true" 无效的解决办法

 

推荐安卓开发神器(里面有各种UI特效和android代码库实例)

  1. 首先高度要固定  
  2.   
  3. listView item的布局中RelativeLayout的高度要是一个固定的值  
  4. 如下  
  5. android:layout_height="?android:attr/listPreferredItemHeight"  

 

 

其次:加载 layout文件 创建LayoutInflater对象的时候 要使用:

 

 

  1. convertView = mInflater.inflate(R.layout.list_item_kind, parent, false);  
  2.   
  3. 不能使用   
  4. convertView = mInflater.inflate(R.layout.list_item_kind, null); //error  

 

 

把这俩问题解决了 就ok了

 

。 该bug在 android 2.2 以上的版本已经解决

+=======================================

你可能感兴趣的:(RelativeLayout)