2015-04-07 57 views
0

我的问题是imageview和屏幕之间的空白区域,我希望该imageview宽度是相同的sceen,所以有办法从xml文件中删除此边距(白色空间) ? 这是截图 http://s15.postimg.org/coxrf6b2z/Capture.png 我没有找到任何解决办法...删除android布局marging

和XML文件:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:orientation="vertical" 
android:layout_width="match_parent" 
android:background="@drawable/layout_back" 
android:layout_height="match_parent" 
tools:ignore="MergeRootFrame" 
> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/fl" 
    android:adjustViewBounds="true" 
    tools:ignore="MergeRootFrame" > 




    <ImageView 
     android:id="@+id/image_header" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
     tools:ignore="MergeRootFrame" 
     android:scaleType="centerCrop" 
     android:src="@drawable/wlp" /> 


    <View 
     android:layout_width="match_parent" 
     android:layout_height="68dp" 
     android:background="@drawable/gradient"/> 


    <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:text="@string/bienvenue" 
      android:id="@+id/tvBienvenue" 
      android:layout_alignParentTop="false" 
      android:layout_centerInParent="true" 
      android:textColor="#ffffffff" /> 

    <Spinner 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/spinner" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" /> 


</RelativeLayout> 

<ListView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/listView" 
     android:layout_below="@+id/fl" 
     android:layout_above="@+id/l1" /> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="false" 
     android:layout_alignParentEnd="true" 
     android:gravity="bottom" 
     android:layout_gravity="bottom" 
     android:id="@+id/l1" 
     android:layout_alignParentBottom="true"> 


    </LinearLayout> 

</LinearLayout> 

在此先感谢!

回答

0

我认为这是由您的android:scaleType="centerCrop对您的ImageView造成的,请尝试将其设置为FIT_XY,看看会发生什么。

+0

no nothing changed ....这个布局代表了swipeview活动的一个片段..我认为这可能会帮助你理解 –

+0

对不起,它应该是'android:scaleType =“fitXY”'。但如果这不起作用,我会设置背景颜色为粉红色或其他东西,看看它是否实际上是边距或是否是填充。如果颜色出现,它会填充,否则由于某种原因,您的'ImageView'实际上就是这个尺寸。然后,我将颜色设置到它的容器,看看发生了什么。 –

0

在您的布局中没有保证金或填充,我复制粘贴您的代码并看到没有保证金。确保它不是你图片的一部分。

中心裁剪也会填充图像视图。那不是你的问题。

+0

它不是图像的一部分看这张图片http://s3.postimg.org/kk7hk0jjn/Capture.png它是在选择imageview后捕获的 –