android - Layout being measured twice, what could be the issue? -


i using following layouts:

<merge xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">      <videoview         android:layout_width="match_parent"         android:layout_height="match_parent" />      <progressbar         android:visibility="invisible"         android:id="@+id/progress"         android:layout_gravity="center"         android:layout_width="wrap_content"         android:layout_height="wrap_content" />      <linearlayout         android:id="@+id/llsearch"         android:visibility="visible"         android:background="#50aaaaaa"         android:paddingtop="10dp"         android:gravity="center_vertical"         android:paddingbottom="10dp"         android:orientation="horizontal"         android:layout_width="match_parent"         android:layout_height="72dp">          <imageview             android:layout_marginleft="16dp"             android:layout_marginstart="16dp"             android:src="@drawable/abc_ic_search_api_mtrl_alpha"             android:layout_width="40dp"             android:layout_height="40dp" />          <edittext             android:textcolor="@android:color/white"             android:textcolorhint="@android:color/white"             android:background="@android:color/transparent"             android:visibility="visible"             android:maxlines="1"             android:layout_width="match_parent"             android:layout_height="match_parent" />      </linearlayout>      <android.support.v7.widget.recyclerview         android:visibility="invisible"         android:layout_margintop="72dp"         android:layout_width="match_parent"         android:layout_height="match_parent"/>      <android.support.v7.widget.recyclerview         android:visibility="gone"         android:layout_margintop="72dp"         android:layout_width="match_parent"         android:layout_height="match_parent"/>      <com.myapp.custom.revealview         android:id="@+id/reveal"         android:layout_width="match_parent"         android:layout_height="match_parent"/>  </merge> 

when running app through ddms, i've noticed layout ends being measured twice, why , how can prevent overdraw?

enter image description here

what's strange can't figure out other linearlayouts coming from.

measuring twice isnt overdraw. depending on type of layout you're using android might need measure twice because of relationship between child views require it. can happen layouts linearlayout or relativelayout. exact reason need check source of those, hardly issue (usually).

but if have recycleview should avoid using big nested layouts inside.


Comments