我一直在为这一整天的事情而苦苦挣扎。我想在我的LinearLayout中使用3个图像视图。正如你所看到的,这个比例是不正确的。我所有的图标都有24x24像素的大小。在我的ImageViews里面试验过不同的房产。LinearLayout中的ImageViews - 搞乱了规模
这里是我的XML代码:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="45dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/tList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scaleType="fitXY"
android:background="@drawable/ic_home_black_24px" />
<ImageView
android:id="@+id/ist"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scaleType="fitXY"
android:background="@drawable/ic_help_black_24px"
/>
<ImageView
android:id="@+id/ations"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scaleType="fitXY"
android:background="@drawable/ic_settings_black_24px"
/>
</LinearLayout>
您是否尝试过改变每个'ImageView'的'“FILL_PARENT”'属性?填充父项将强制'ImageView'适合父项的宽度和高度。 – pamobo0609
也许最好的办法是尝试在宽度和高度上使用'wrap_content'属性,或者使用'dp'相当于'24px' – pamobo0609
是的,我首先将它设置为wrap_content,但这并没有让它变得更好。我甚至尝试将layout_width和layout_height设置为24dp。仍然搞砸了规模... –