我对如何保持图片的实际尺寸感到困惑!
例如,我有一个名为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”
当我设置另一个png文件应该粘在上面并从左向右拉伸并设置它的android:layout_height =“wrap_content”时,高度也会失真,所以我无法将所有设计放入。发生了什么?
我只需要我的实际尺寸,不多也不需要
我被问到布局 - 它只是2张图片,1张是瓷砖,第2张是上面的代码 位图比瓷砖大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>
答案 0 :(得分:0)
你能更具体地了解你在寻找什么吗?
如果您需要图像达到最小或原始高度,您可以使用
android:layout_height="wrap_content"
这将使您的图像达到最小高度或原始高度
android:layout_width="fill_parent"
会使图像从左到右或宽度方向拉伸。