我有两张图片——左边是播放按钮,右边是音箱。我正在尝试缩放这些图像的高度和宽度,使其看起来像这样
虽然我的代码产生了这个:
本质上,文件很大而且大小不正确,但我不知道为什么 boombox 图像被截断了。我想要整个音箱适合,然后播放按钮根据音箱的高度调整其高度。
这是我的布局代码,但我认为我需要进行大的更改:
<GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:stretchMode="columnWidth"
android:numColumns="2"
android:scaleType="fitXY"
>
<ImageView
android:id="@+id/play_stop_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="0"
android:src="@drawable/play_button_final"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_column="1"
android:scaleType="fitXY"
android:src="@drawable/boombox"
android:id="@+id/boombox"
/>
</GridLayout>
最佳答案
试试这个,
<GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:stretchMode="columnWidth"
android:numColumns="2"
android:scaleType="fitXY"
>
<ImageView
android:id="@+id/play_stop_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_column="0"
android:src="@drawable/play_button_final"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_column="1"
android:scaleType="fitXY"
android:src="@drawable/boombox"
android:id="@+id/boombox"
/>
</GridLayout>
关于android - 在网格布局中并排调整和缩放两个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31034185/