9张补丁图片没有拉伸

时间:2016-10-11 09:20:23

标签: android nine-patch

创建了9个补丁图像,没有更多"坏补丁"显示。在编辑器中似乎已经很好地设置了。但是在屏幕上放置了 png 图像,而不是拉伸的9补丁文件,问题是什么?清理,重建项目。我设置了红色背景颜色,以查看imageview的宽度。 "你好"在imageview上方。

holder.imageView.setX(dp10);
holder.imageView.setY(dp18);
holder.imageView.getLayoutParams().height = h+dp4;
holder.imageView.getLayoutParams().width = ww+dp20;
holder.imageView.setBackgroundColor(Color.RED);

enter image description here

enter image description here

作为@pskink建议的Coorected layout xml。工作,但提出了另一个问题。请参见气泡侧面的曲线。曲线应该看起来像一个圆圈,但现在太过拉伸了。

enter image description here

这里是xml部分:

<ImageView
    android:id="@+id/imageView3"
    android:layout_marginStart="10dp"
    android:layout_marginEnd="20dp"
    android:layout_marginBottom="5dp"
    android:layout_marginTop="5dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bubbleblue170x140_2" />

这是9补丁文件:

enter image description here

enter image description here

0 个答案:

没有答案