我有XML,其中圖像填滿屏幕的60%:爲什麼layout_weight工作在不同設備上的不同
<RelativeLayout
android:id="@+id/rl_images_layout"
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="wrap_content"
android:layout_marginBottom ="5dp">
<com.my.proj.view.ContentUpdatableImageView
android:id="@+id/iv_template1_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart" />
<ImageView
android:id="@+id/ivResizeIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/iv_template1_image"
android:layout_alignTop="@id/iv_template1_image"
android:background="@drawable/btn_pinch" />
<ImageView
android:id="@+id/ivRotateIcon"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_alignRight="@id/iv_template1_image"
android:layout_alignBottom="@id/iv_template1_image"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/btn_rotate"
android:visibility="gone" />
</RelativeLayout>
<View
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="4" />
在一個手機,它工作正常(LG P500),但在其他設備(HTC Desire HD的)圖像填充只有40%。有任何想法嗎?
是什麼一個「視圖」的樣子?這是一個抽象類,所以我可以告訴你不應該像這樣使用它。在我的頭頂,這似乎是一個可能的事情。用一個'FrameLayout'替換它,看看視圖的其餘部分是否正確測量。 – DeeV