java Android如何保持图像的实际大小?
我完全不知道如何保持图像的实际大小
例如,我有一个名为bottom_tile的png。png,如果我把它按原样放在布局上,它只有一个尺寸。如果我制作这样的平铺位图:
<bitmap xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:src="@drawable/ver_bottom_panel_tile"
安卓:tileMode="repeat"
安卓:dither="true"
/>
把它放在我的布局上,它的高度会有所不同,尽管它只有一块瓷砖高,所以它们应该是精确的高度!为什么会这样?这两种情况都是:layout_height=“wrap_content”
当我设置另一个png文件时,它应该贴在顶部,从左到右拉伸,并设置为安卓:layout_height=“wrap_content”,高度也会扭曲,所以我无法将所有设计都放进去。怎么回事
我只需要我的实际尺寸,不多不少
有人问我布局——只有两张图片,一张是瓷砖,第二张是上面代码中的内容 位图比瓷砖大40%
<RelativeLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
安卓:id="@+id/imageView1"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_alignParentLeft="true"
安卓:layout_alignParentTop="true"
安卓:src="@drawable/ver_bottom_panel_tile" />
<ImageView
安卓:id="@+id/imageView2"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_alignParentLeft="true"
安卓:layout_below="@+id/imageView1"
安卓:src="@drawable/ver_bottom_panel" />
</RelativeLayout>
# 1 楼答案
你能更具体地说明你在找什么吗?
如果您需要图像达到最小或原始高度,可以使用
android:layout_height="wrap_content"
这将使您的图像达到最小高度或原始高度
android:layout_width="fill_parent"
将使你的图像从左向右或宽度方向拉伸