我正在制作布局并使用“layout_weight”和“weight_sum”。我将线性布局的方向设置为水平,以便能够将ImageView的宽度设置为屏幕的1/3。但是我不知道如何将ImageView的高度设置为屏幕的1/3。
请帮助我从布局xml中设置ImageView的高度为屏幕的1/3。
请帮助我从布局xml中设置ImageView的高度为屏幕的1/3。
<?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="match_parent"
android:orientation="horizontal"
android:weightSum="1">
<ImageView
android:id="@+id/savedImageView"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".33"
android:background="@drawable/background" />
</LinearLayout>
提前致谢
android:scaleType="centerCrop"
。 - Marek