2011-04-24 2 views
4

텍스트 줄을 여러 줄로 감싸려고 TextView를 가져 오려고하지만 항상 첫 줄 끝에서 잘게 잘린 것처럼 보입니다. 여기 내보기에서 해당 XML입니다 : 내가 그것을 포장하기 위해 여러 가지를 시도했습니다Android TextView보기를 줄 바꿈하는 방법은 무엇입니까?

<RelativeLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" android:id="@+id/relExtraInfo" 
     android:layout_below="@+id/titleContainerLayout"> 

     <RelativeLayout android:layout_height="wrap_content" 
      android:layout_width="fill_parent" android:layout_below="@+id/titleArtwork" 
      android:id="@+id/relStarring"> 
      <TextView android:textStyle="bold" android:layout_height="wrap_content" 
       android:text="Starring:" android:layout_width="wrap_content" 
       android:id="@+id/lblStarring" android:layout_alignParentLeft="true"></TextView> 
      <TextView android:layout_alignTop="@+id/lblStarring" 
       android:text="This is a very long peice of text to try and get the TextView to spill over multiple lines." 
       android:layout_alignBottom="@+id/lblStarring" android:id="@+id/txtStarring" 
       android:layout_toRightOf="@+id/lblStarring" android:layout_width="fill_parent"></TextView> 
     </RelativeLayout> 

     <RelativeLayout android:layout_height="wrap_content" 
      android:layout_width="fill_parent" android:id="@+id/relDirector" 
      android:layout_below="@+id/relStarring"> 
      <TextView android:layout_height="wrap_content" 
       android:layout_width="wrap_content" android:layout_alignParentLeft="true" 
       android:text="Director:" android:textStyle="bold" android:id="@+id/lblDirector"></TextView> 
      <TextView android:layout_height="wrap_content" 
       android:text="TextView" android:layout_width="wrap_content" 
       android:layout_alignTop="@+id/txtDirector" 
       android:layout_alignBottom="@+id/txtDirector" android:id="@+id/txtDirector" 
       android:layout_toRightOf="@+id/lblDirector" android:ellipsize="none"></TextView> 
     </RelativeLayout> 
    </RelativeLayout> 

내가 없음으로 elipsize 설정 한, scrollHorizontally false로, 심지어 사용되지 않는 만일 Singleline이 = 거짓했는데, 한 그게 작동하지 않습니다.

이 작업을 수행하는 방법과 동일한 질문을하는 수많은 사람들이 있으며, 어느 누구도 확실한 답을 얻지 못하는 것 같습니다.

답변

9

그래서 대답은 RelativeLayout & 여러 줄로 된 TextView가 함께 놀지 않아서 2 개의 내부 RelativeLayout 요소를 LinearLayout으로 변경하고 TextView에 갑자기 여러 줄이있는 것입니다.

+0

이 시간에 맞았지만 현재 날짜에 대한 업데이트 일 수 있습니다. RelativeLayout은 여러 줄로 된 TextViews에서 내용을 래핑하는 데 적합합니다. –

0

TextViewandroid:width="0dip"을 추가하십시오.

+2

이렇게하면 TextViews가 보이지 않게됩니다. –

+0

android : width = "0dip"대신에 linearlayuot 내부의 TextView가 있기 때문입니다. 당신은 상대적 레이아웃을 사용하고 있으므로 보이지 않는지 확인하십시오. – karan

관련 문제