Mon*_*ica 2 xml android imagebutton
我一直在寻找一个答案,但我找不到适合我的答案.我想在线性布局中将三张图片放在同一行中.我希望它们是ImageButtons,这是我的代码:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:id="@+id/ImageButton05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="centerInside"
android:src="@drawable/background" />
<ImageButton
android:id="@+id/ImageButton04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="centerInside"
android:src="@drawable/background" />
<ImageButton
android:id="@+id/ImageButton03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="centerInside"
android:src="@drawable/background" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我得到的问题是,由于图片"背景"太大,按钮的重量显示正确,而高度比预期的要大很多.它看起来像这样:
看起来像http://imageshack.us/a/img18/1516/x3qi.png
它看起来应该是这样的:
应该看看http://imageshack.us/a/img855/834/403t.png
如何在不指定dp大小的情况下解决这个问题?