私は次のビュー階層を持っています:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/group_bg"
android:gravity="center_vertical"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/itemplace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1" >
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/pin" />
</LinearLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/arrow_black"/>
</LinearLayout>
</LinearLayout>
この階層が描画される前に、アイテムプレースの幅を取得する必要があります。API レベル 7 を使用しているため、OnLayoutChangeListener を使用できません。
ビューのサイズを計算するには、 measure() および layout() メソッドを使用する必要があることは知っていますが、それを行うのが難しいことはわかりません。
私の階層のルート ビューは画面の全幅を埋める必要があるため、itemplace の幅は親のサイズ、親のパディング、および FrameLayout の幅に依存していました。
幅を確保するにはどうすればよいですか?