Android: 調用LayoutInflater方法時warning和exception

前言:Layout Inflation的作用正如inflate字面意思表示的一樣:膨脹,充氣。將XML文件轉換成View結構對象。在繪製界面時,經常會出現以下幾類問題,總的來說,還是因爲對Android的View結構和LayoutInflation不夠理解,所以從分析幾個問題出發,好好理解Android界面設計的一些思想和方法。


警告

Warning: “Avoid passing null as the view root” warning when inflating
view for use by AlertDialog.

異常

java.lang.IllegalStateException: The specified child already has a
parent. You must call removeView() on the child’s parent first.

BUG

將ListView中的每個Item高度設置爲wrap_content卻不起作用

發佈了37 篇原創文章 · 獲贊 15 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章