標籤:
好久沒寫博了,因為最近在忙著做一個app,實在是沒有時間。現在快完工了。想著還是把這個布局問題說一下,相信很多人都遇到了,而且但凡是寫的稍微複雜一點的layout,遇到的不止一次。
對於一個強迫症的人來說,看見這個2,立馬想讓它消失。開啟lint一看,全是同一個問題,如下:
意思大概是丟失了關於image的說明,那就手動給它添加一條唄。android:contentDescription="@string/value"
其他:
- Set android:baselineAligned="false" on this element for better performance
- 如果LinearLayout被用於嵌套的layout空間計算,它的android:baselineAligned屬性應該設定成false,以加速layout計算
- android:baselineAligned="false"
- This LinearLayout layout or its RelativeLayout parent is useless;
- 多餘的Linearlayout或者RelativeLayout
- 刪除即可
- This tag and its children can be replaced by one <TextView/> and a compound drawable
- 有時候我們可能會用image+textview組合,但其實image是沒必要的,textview提供了一個屬性來給它設定image
- android:drawable="@drawable/resource"
- Use a layout_height of 0dip instead of wrap_content for better performance
- 當在一個linearlayout布局中為一個控制項設定weight屬性時,這個組件會預設填充剩餘空間
- 去掉weight屬性或者修改wrap_content為0dp
- Buttons in button bars should be borderless
- 原因未知
- style="?android:attr/buttonBarButtonStyle"
Android常見布局問題