2014-09-02 4 views
1

저는 imageview와 다음 textview 사이에 (검은 색) 공백을 원하지 않습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까? 당신의 도움을 주셔서 감사합니다. Android 레이아웃 문제

  <RelativeLayout 
      android:id="@+id/layout_contentView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/club_banner" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:scaleType="fitStart" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentRight="true" 
       android:layout_centerHorizontal="true" /> 

      <TextView 
       android:id="@+id/condition_1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentRight="true" 
       android:layout_below="@id/club_banner" 
       android:background="@drawable/overview_cell_header_bg" 
       android:gravity="center_vertical" 
       android:paddingLeft="5dp" 
       android:text="@string/Condition_1" 
       android:textColor="#ffffff" 
       android:textSize="13sp" 
       android:textStyle="normal" /> 

enter image description here

답변

2

문제 firStart 것 만 화상 X 또는 Y 축

documentation 하나를 확장 선택하는 Matrix.ScaleToFit에서 START 상수를 사용한다는 대신 x 및 y 축에서 이미지의 크기를 조절하려면 fitXY을 사용해야합니다.

+0

thx,하지만 왜이 공간이 첫 번째 장소에 있습니까? – jay

+1

@jay 문서가 말하는대로. 그것은 당신의 시야 안에 들어갈 것이지만 적어도 축 중 하나에 맞을 것입니다, 그래서 문제는 x 축에는 맞지만 y 축에는 맞지 않습니다. 왜 그 일을하는거야 ?? '종횡비'를 유지하기 위해 크기 조절을하기 때문에 –

1

문제점 :

android:scaleType="fitStart" 

가 이것은 이미지 뷰의 시작 (상)에 화상을 맞춤한다.

scaleType을 필요에 맞는 다른 것으로 변경하십시오.

Compute a scale that will maintain the original src aspect ratio, 
but will also ensure that src fits entirely inside dst. At least one 
axis (X or Y) will fit exactly. 

용액 :

+0

확인 = "true"를 adjustViewBounds을하지만 fitstart 사용하는 것이 가능하고 다음을 가져야한다 요소가 정확히 이미지 뷰 아래에 있는지 여부 – jay

+0

당신에게 가능한 또 다른 것이 없습니까? http://etcodehome.blogspot.be/2011/05/android-imageview-scaletype-samples.html –

+0

다른 것을 사용할 수 있습니다. 것은 내가 직접 애플 리케이션을 작성하지 않았다. 왜 내가이 패딩 문제가 있는지 확인할 수있는 코드의 다른 부분이 있습니까? – jay

0

귀하의 코드를 시도하고 예상 한 결과가 나타납니다.

이미지에 문제가 있어야합니다. 사진 아래의 부분이 실제로 투명합니까?

enter image description here

+0

hm 이미지에는 투명 영역이 없습니다. 목소리를 확인해 주셔서 감사합니다. – jay

0

이에 관심이 누구를 위해 내가 단순히

안드로이드 추가하여 문제를 해결 :