1. 程式人生 > >listView 中relativeLayout 佈局的 android layout alignParentBotto

listView 中relativeLayout 佈局的 android layout alignParentBotto

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow

也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!

               

[xhtml] view plain copy print ?
  1. 首先高度要固定  
  2.   
  3. listView item的佈局中RelativeLayout的高度要是一個固定的值  
  4. 如下  
  5. android:layout_height="?android:attr/listPreferredItemHeight"  
首先高度要固定listView item的佈局中RelativeLayout的高度要是一個固定的值如下android:layout_height="?android:attr/listPreferredItemHeight"

其次:載入 layout檔案 建立LayoutInflater物件的時候 要使用:

[java] view plain copy print ?
  1. convertView = mInflater.inflate(R.layout.list_item_kind, parent, false);  
  2.   
  3. 不能使用   
  4. convertView = mInflater.inflate(R.layout.list_item_kind, null
    ); //error  
 convertView = mInflater.inflate(R.layout.list_item_kind, parent, false);而不能使用  convertView = mInflater.inflate(R.layout.list_item_kind, null); //error

 把這倆問題解決了 就ok了

。 該bug在 android 2.2 以上的版本已經解決

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

相關連結:

http://www.isomobile.com/read.php?tid-462.html

http://code.google.com/p/android/issues/detail?id=1394

http://stackoverflow.com/questions/2520418/androidlayout-alignparentbottom-is-ignored-when-used-without-explicit-layout-hei#answer-2524471

 

           

給我老師的人工智慧教程打call!http://blog.csdn.net/jiangjunshow

這裡寫圖片描述