Android常見錯誤處理(一)

來源:互聯網
上載者:User

標籤:des   android   style   io   ar   color   os   使用   sp   

1、Set android:baselineAligned="false" on this element for better performance

如果LinearLayout被用於嵌套的layout空間計算,它的android:baselineAligned屬性應該設定成false,以加速layout計算


2、This tag and its children can be replaced by one <TextView/> and a compound drawable

如果我們想用一個TextView和ImageView的組合,並不需要使用這兩個組件,只要對TextView使用一個drawable就行了,例如android:drawableTop="....."


3、Missing contentDescription attribute on image

跟Image有關的空間需要一個描述,要解決這個問題的話加上一個Null 字元或者@string/App_name即可


4、This LinearLayout layout or its LinearLayout parent is possibly useless

在LinearLayout布局當中嵌套了一個子的LinearLayout布局,而在我的這個整個布局檔案中是一最外層的LinearLayout為父控制項進行整體布局的,從而造成這段布局代碼重複了LinearLayout布局。所以只要把多餘的LinearLayout去掉就可以了


5、Nested weights are bad for performance

在布局進行嵌套使用時,父布局與子布局都使用了android:layout_weight,但不是必須使用時,便會出現如題所示的警告資訊。

Android常見錯誤處理(一)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.