2013-06-13 6 views
2

뷰에 내용을 최소한으로 포장해야하지만 상위 뷰에서 스트레칭, 그것이 부모를 채우기보다?Android 레이아웃 - 부모에게 내용을 채우지 만 내용은 적어도 랩핑해야 함을 뷰에 알리는 방법

예 :

내가 원하는, 그것은 콘텐츠의 ... 그리고 그 경우에 내 제목 텍스트 뷰는 스크롤 뷰보다 넓은 주위에 컨테이너 선형 레이아웃을 감싸는 것을, 그것을 잘라하지 않습니다! 내가 wrap_content에 제목 텍스트 뷰를 설정하면, 그것은 무엇을 의미하는 이미지 뷰 인 경우

<LinearLayout 
       android:id="@+id/llWeightsParent" 
       style="@style/group" 
       android:layout_width="wrap_content" 
       android:layout_height="fill_parent" 
       android:clickable="true" 
       android:onClick="onClick" 
       android:orientation="vertical" > 

       <TextView 
        android:id="@+id/tvWeight" 
        style="@style/text_group_title" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_margin="1dp" 
        android:text="@string/weight" /> 

       <ScrollView 
        android:id="@+id/svWeights" 
        android:layout_width="wrap_content" 
        android:layout_height="fill_parent" > 

        <LinearLayout 
         android:id="@+id/llWeights" 
         style="@style/group_content" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:orientation="vertical" > 
        </LinearLayout> 
       </ScrollView> 
      </LinearLayout> 
+0

일부 코드는 문제에 대해 자세히 설명해줍니다. –

+0

은 'LinearLayout' 또는'RelativeLayout'으로 텍스트보기를 둘러 쌉니다. 주변 레이아웃은 match_parent와'TextView' wrap_content를 가지므로 부모를 채우고 wrap_content도 갖습니다. – bogdan

+0

방금 ​​시도했는데 ... 역시 작동하지 않습니다 ... 여전히 내 예제와 같은 동작입니다 ... – prom85

답변

0

, 당신은 설정할 수 있습니다 ...있는 ScrollView 제목보다 넓은 경우는 부모의 기입하지 않습니다

android:layout_width="match_parent" 
android:scaleType="centerInside" 

다른 사람들에게 나는 단지 android:layout_width="match_parent"을 설정하고 그것에 대해 너무 걱정하지 않을 것입니다.

+0

아니요, 실제로 그 위에 제목 텍스트 뷰가있는 스크롤보기가 있습니다 ... – prom85

+0

layout_width를 'match_parent'로 설정하는 것이 충분하지 않은 이유를 자세히 설명해 주시겠습니까 너를 위해서? – Neoh

+0

방금 ​​예제와 자세한 설명을 추가했습니다 ... 문제가되는 두 부분의 복잡성입니다 ... – prom85