2011-08-18 7 views
3

9.PNG 이미지를 RelativeLayout의 배경으로 설정하면 내부의 모든 요소가 가운데로 수축됩니다. 다음은 XML과 스냅 샷입니다. 나는 색상이나 일반 이미지로 배경을 변경하는 경우 RelativeLayour의 nine 패치 이미지가 모든 내부 요소를 숨기는 이유는 무엇입니까?

<RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@drawable/bg" 
     > 
    <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Just a simple white text which does not show up" 
      android:textColor="#ffffff" 
      /> 
</RelativeLayout> 

nine-patch background

, 나는 텍스트를 얻을. 이런 일이 왜

android:background="@drawable/bg2" //normal image 

normal-image background

는 사람이 설명 할 수 있습니까?

+0

여기에 문제에 대한 명확한 답변이 나와 있습니다. http://stackoverflow.com/questions/3904852/android-layout-broken-with-9-patch-background –

답변

6

9 패치의 내용 영역을 정의 했습니까? 콘텐츠 영역처럼 보이기 때문에 중간에 작은 픽셀이 있습니다.

콘텐츠 영역은 9 패치의 하단과 우측에 의해 정의됩니다. 예를 들어 패치만큼 크게 만들 수 있습니다.

관련 문제