Android 缺陷ImageView导致背景图像拉伸
我正在尝试编写表示以下GUI的xml:Android 缺陷ImageView导致背景图像拉伸,android,android-layout,Android,Android Layout,我正在尝试编写表示以下GUI的xml: -------------------- | <text>| | <text>| | | |<pic> | -------------------- 在图像视图中,背景图像被拉伸,看起来很难看 如何将图像设置为左下角,而不导致背景拉伸 谢谢 首先,谢谢你的帮助。。。。 我试过你最后的建议 尝试将相对布局和线性更改为:
--------------------
| <text>|
| <text>|
| |
|<pic> |
--------------------
在图像视图中,背景图像被拉伸,看起来很难看
如何将图像设置为左下角,而不导致背景拉伸
谢谢
首先,谢谢你的帮助。。。。
我试过你最后的建议
尝试将相对布局和线性更改为:android:layout\u width=wrap\u content android:layout\u height=wrap\u content
还是没有成功。。。
我使代码变得更容易-删除了外部布局
<RelativeLayout
android:id="@+id/widget48"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/single_detail"
>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:paddingTop="50px"
android:paddingRight="25px"
android:textStyle="bold"
android:textColor="#0000FF"
>
</TextView>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_alignParentRight="true"
android:paddingTop="10px"
android:paddingRight="25px"
android:textColor="#0000FF"
>
</TextView>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
还是和图片中看到的一样的问题。。。。其他想法
我绝望了
救命啊!!!!求你了 如果你想让图像成为版面的背景,就把它放在相对版面的android:background=中
但是,如果您想使用imageView,可以在图像视图中更改android:scaleType=,使其不会拉伸,下面是一个问题示例: 好: 坏的:
尝试了您的建议,但这并不能解决问题。更具体地说,ImageView并不是被拉伸的对象-问题在于在我将alignParent属性添加到ImageView时拉伸的背景图像,因此缩放ImageView似乎不是这里的答案。还有什么建议吗?谢谢我不明白,请澄清:是否要从布局中排除图像视图,以便背景不会拉伸?在我的帖子中绘制时,我希望在文本视图和图像视图后面有一个背景图像,并且能够将图像视图与包含视图的左下角对齐。如果我没有在imageview上设置alignparent参数,背景图像+文本视图+imageview看起来很好-但是imageview没有对齐。当添加对齐时,我可以看到imageview以正确的大小对齐到正确的位置,但是会导致背景图像拉伸并变得难看-这是我的问题。。。。希望现在它更清晰一点…如果文本视图+图像视图所覆盖的空间比背景大,那么您需要一个新的,它不比背景大。。。。。。。。。。。。背景会无缘无故地被拉伸……第一张图片展示了使用PaddingTop解决方案时的外观,第二幅图显示了在xml中添加两行后背景是如何拉伸的。。。
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
<RelativeLayout
android:id="@+id/widget48"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/single_detail"
>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:paddingTop="50px"
android:paddingRight="25px"
android:textStyle="bold"
android:textColor="#0000FF"
>
</TextView>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_alignParentRight="true"
android:paddingTop="10px"
android:paddingRight="25px"
android:textColor="#0000FF"
>
</TextView>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>