2012-07-27 3 views
0

과 같은 제목은 이미지의 앞뒤에 "공간"이 있으며 나는 그것을 원하지 않는다고 말했습니다.공간 불필요한 레이아웃과 이미지

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:background="@drawable/fond" 
    > 


    <ImageView 
     android:id="@+id/imageView1" 
     android:contentDescription="@string/desc" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/top" 
     android:layout_gravity="top"   
    /> 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     android:background="@drawable/fond1" 
     > 



    </LinearLayout>  
</LinearLayout> 

그래서 처음으로 배경이있는 레이아웃을 볼 수 있습니다. ImageView는 바로 뒤에 있고 맨 위에 있어야하지만 그렇지 않습니다. 두 번째 레이아웃은 이미지보다 훨씬 뒤에 있습니다. ->

첫번째 레이아웃

누군가가 삭제하는 방법을 알고 있다면

이 space--

초 레이아웃

을 --unwanted space--

이미지를 --unwanted 이 "공간", 고마워.

+0

먼저 확인하십시오. 나는 이미지에 문제가 있다고 생각한다. 가능하다면 이미지도 업로드 해주세요. –

+0

사진의 상단에 투명한 공간이 없습니까? – VinceFR

+0

나는 아주 느린 인터넷을 가지고 업로드하려고한다. – user1527152

답변

2

사용 android:adjustViewBounds="true" 당신의 ImageView를 내부. 그러면 ImageView이 제공된 이미지 범위로 조정됩니다.

+0

공간이 없지만 "이미지의 가로 세로 비율을 유지하지 못합니다"라고 말한 것과 내가 찾고있는 것과 잘 어울리는 것을 알 필요가 있습니다. – user1527152

+0

안드로이드 : scaleType 속성 중 아무 것도 내가 필요한 것에 적합하지 않습니다. – user1527152

+0

@ user1527152 그런 다음 여전히 android : scaleType = "fitXY"'를 사용하지만 이미지와 같은 종횡비로 이미지 뷰를 만들 것을 제안합니다. VinceFR이 제안했듯이, 이미지의 경계에 삼각형이있는 공간이 있는지 확인하십시오. – Angelo

0

을 사용하여 상대 레이아웃이 방법 ::

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:background="@drawable/fond" 
    > 


<ImageView 
    android:id="@+id/imageView1" 
    android:contentDescription="@string/desc" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/top" 
    android:layout_gravity="top" 
    android:layout_alignParentTop="true" 
/> 

<LinearLayout 
    android:layout_below="@+id/imageView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:background="@drawable/fond1" 
    > 
</LinearLayout>  
</RelativeLayout> 
+0

이 코드는 똑같은 일을합니다. ( – user1527152