我完全不知道如何保持图像的实际大小!
例如,我有一个名为 bottom_tile.png 的 png,如果我将它按原样放置在布局上 - 它是一种尺寸。如果我制作这样的平铺位图:
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ver_bottom_panel_tile"
android:tileMode="repeat"
android:dither="true"
/>
并将它放在我的布局上,它的高度会有所不同,虽然它只有一格高,所以它们应该是精确的高度!为什么会这样?两种情况 android:layout_height="wrap_content"
当我设置另一个应该贴在顶部并从左到右拉伸并将其设置为 android:layout_height="wrap_content" 的 png 文件时,高度也被扭曲了,所以我无法将所有设计放入其中。这是怎么回事?
我只需要我的实际尺寸,不多不少
我被问到布局 - 它只有 2 张图像,1 是瓷砖,第二是上面代码中的内容位图比瓷砖大 40%+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/ver_bottom_panel_tile" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/imageView1"
android:src="@drawable/ver_bottom_panel" />
</RelativeLayout>