1
で宣言された相対的なレイアウトの大きさは、これが私のxmlです取得:XML
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/header"
android:background="@android:color/white"
>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/btnBack"
android:text="Back"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
/>
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/icon"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_below="@+id/@+id/header"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/view"
android:layout_above="@+id/footer"
>
</RelativeLayout>
<RelativeLayout
android:id="@+id/footer"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:background="@android:color/white"
>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/btn1"
android:text="btn1"
android:layout_alignParentLeft="true"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/btn2"
android:text="btn2"
android:layout_centerHorizontal="true"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/btn3"
android:text="btn3"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
相対レイアウトビューには、2つのレイアウトの間です。 私はこの相対的なレイアウトのサイズ(つまり、高さと幅)を自分のコードで取得したいと思っています。getWidthとgetHeightを使って試しましたが、0を表示しています。 他の方法はありますか?
はこれをしようとしたが、それは私にそれがこの作品の罰金私に – droid
の両方を与えた!!!! – droid
チェックした結果を与えていないこのように、高さと幅は0 –