9patch创建额外的透明边框:如何删除?

时间:2014-06-18 19:06:09

标签: android xml android-layout nine-patch

我的Android应用程序中有一个XML文件。前两个线性布局如下图所示。

布局1 - 半圆

布局2 - 矩形 enter image description here

注意: 半圆和矩形之间没有间隙。这个差距是我现在要解决的问题。

实际上布局1(水平)有三个子布局(垂直),中间子布局包含半个cirlce的图像视图。

当我不使用9补丁图像时,没有间隙并且它与布局2完美融合。但是我需要使用9补丁图像,因为半圆的可能不正确拉伸。

但是当我使用9patch图像时,在两个布局之间创建了这个奇怪的分区。

它必须是9patch问题。但是怎么解决呢? 我只需要一种方法来使用这个半圆的9patch图像而没有这个间隙,因为它可能看起来很奇怪。

注意: 9patch点仅在左侧和左侧空白,而不是顶部和底部的任何位置。

enter image description here

这是XMl文件的摘录:

 <LinearLayout
     android:id="@+id/name"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="horizontal" >

     <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:orientation="vertical"
         android:layout_weight="2" >
     </LinearLayout>

     <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:layout_weight="1.98"
         android:gravity="center_horizontal" >

         <ImageView
             android:id="@+id/imageView1"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:src="@drawable/semicircle" />

     </LinearLayout>

     <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:orientation="vertical"
         android:layout_weight="2" >
     </LinearLayout>

 </LinearLayout>


 <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="2.0"
    android:background="@drawable/rectangle" >

</RelativeLayout>

0 个答案:

没有答案
相关问题