2014-10-19 3 views
0

왼쪽 하위 텍스트 TextView (회색)가 오른쪽의 TextView (노란색)의 LinearLayout에서 우선 순위 가중치를 사용하도록하는 문제가 있습니다. 오른쪽의 TextView는 항상 우선 순위가 높은 것처럼 보이고 왼쪽의 TextView는 줄 바꿈됩니다. 어떤 도움을 주셔서 감사합니다.Android TextView 가중치

TextView weights issue

레이아웃에 대한 XML은 다음과 같이이다 :

<LinearLayout 
    android:id="@+id/LinearLayout03" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="-4dip" > 

    <TextView 
     android:id="@+id/TextView_nowplaying" 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:ellipsize="end" 
     android:maxLines="3" 
     android:singleLine="true" 
     android:textColor="#ddd" 
     android:textSize="13dip" > 
    </TextView> 

    <TextView 
     android:id="@+id/TextView_listeners" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:singleLine="true" 
     android:textColor="#aaa" 
     android:textSize="13dip" > 
    </TextView> 

    <TextView 
     android:id="@+id/TextView_bitrate" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingLeft="4dip" 
     android:singleLine="true" 
     android:textColor="#aaa" 
     android:textSize="13dip" > 
    </TextView> 
</LinearLayout> 
+2

상대 레이아웃을 사용하지 않는 이유는 무엇입니까? – Akhil

답변

2

할당에 0dp해야 모든 자식의 LinearLayout

layout_width의 모든 구성 요소에 무게를 시도하십시오 수평 한 LinearLayout

지정 weightSum pa 학부모님께 LinearLayout