我有一个布局问题,我想要一个图像位于两个按钮中间。所以我创建了两个按钮并定义了1的权重总和。然后将两个按钮的权重设置为.40,将图像设置为.20,以便图像在两个按钮的中间是一个小徽标。问题是图像被拉伸,按钮被推到一边。Android:错误地使用imageView重新调整尺寸按钮的布局
<Button
android:id="@+id/buttonClear"
style="@style/ButtonText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight=".40"
android:background="@drawable/custombuttonred"
android:text="@string/clear"
android:textSize="50sp" />
<ImageView
android:id="@+id/myimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".20"
android:src="@drawable/imageid" />
<Button
android:id="@+id/buttonBackspace"
style="@style/ButtonText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight=".40"
android:background="@drawable/custombuttonred"
android:text="@string/backspace"
android:textSize="20sp" />
它是否处于线性布局?如果是的话,它的定位是什么?如果垂直,则不应使用fill_parent作为layout_height – viplezer 2012-03-08 11:12:22
您是否也可以列出封闭的View? – Soham 2012-03-08 11:15:36