我有两个问题,这个布局:的ImageView中的LinearLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="130dp"
android:orientation="horizontal"
android:background="@null">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/image1"
android:id="@+id/image1"
android:scaleType="centerCrop"
android:background="@drawable/card_background"
android:layout_weight=".5"
/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/image2"
android:id="@+id/image2"
android:scaleType="centerCrop"
android:background="@drawable/card_background"
android:layout_weight=".5"
/>
</LinearLayout>
,当我把不同的图像在ImageViews,发生这种情况:
- 的ImageViews高度大于130dp更大,但是我把身高为(match_parent),父身高为130dp。
- ImageViews宽度不一样,但是两个ImageView的重量相同,但较大的宽度比另一个要宽。
你没有给一个weight_sum父布局 –
我做了之后,它仍然是你的意思是相同的 – Maysara
映像不在大小或这些意见相同大小不一样?您可以在imageViews中使用'scaletype = fitxy'来使图像适合其边界 –