關於onMeasure()、onLayout()方法的使用

在寫繼承ViewGroup的自定義View時通常會重寫onMeasure()、onLayout()方法,下面分別說下這2個方法。 1、 onMeasure(): protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } 此方法用於測量自身顯示在頁面上的大小。參數widthMeasureSpec爲父類傳過來的寬
相關文章
相關標籤/搜索