android补丁9在加载动态图像后丢失

android补丁9在加载动态图像后丢失,android,android-layout,android-imageview,Android,Android Layout,Android Imageview,从动态Url加载imageView后,我的linearLayout Background正在丢失补丁9 解决此问题的唯一方法是使用holder.imgView.setScaleType(ImageView.ScaleType.FIT_XY); 但我不想同时拉伸图像 <LinearLayout android:id="@+id/llPatch" android:layout_width="wrap_content" android:layout_height="wrap_co

从动态Url加载imageView后,我的linearLayout Background正在丢失补丁9

解决此问题的唯一方法是使用holder.imgView.setScaleType(ImageView.ScaleType.FIT_XY); 但我不想同时拉伸图像

<LinearLayout
android:id="@+id/llPatch"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/testt1"
    android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageRecette"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="0dp"
            android:padding="0dp"
            android:src="@drawable/tartare" />

</LinearLayout>

9-patch图像与项目一起编译(从您的res文件夹)

如果您向项目中添加一个9-patch,构建它(项目)并查看bin/res/[图像所在位置]/[图像名称].9.png,您可以看到编译后的9-patch的外观

因此,您无法从url加载9补丁图像(两侧有线条)

但是,您可以将已编译的9-patch上载到服务器,下载并按此处指定的方式使用它:

补丁9与我的LinearLayout android:background=“@drawable/testt1”关联,它是从URL加载的图像视图