2013-08-12 3 views
1

나는 this을 시도했습니다. 나는 이런 식으로 할 계획 :레이아웃 무게로 작업하는 것이 더 나은 방법

enter image description here

을하지만이 방법으로 보여주는 :

enter image description here

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/tvHiragana" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Hiragana" 
     android:layout_weight="2" 
     android:textSize="22sp" /> 

    <TextView 
     android:id="@+id/tvKanji" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Kanji" 
     android:textColor="@color/redColor" 
     android:layout_weight="1" 
     android:textSize="20sp" /> 

</LinearLayout> 

나는이 글은 올바른 작동하도록해야 할 일 layout_weight의 조건? TextView에서 새로운 줄을 만드는 것을 피하는 방법?

답변

2

내가해야 할 일은 layout_weight의 조건에서 올바로 작동하게해야합니까? horizontal 레이아웃 weight를 사용하는 경우

첫째, 당신의 width0dp해야한다. 마찬가지로 레이아웃이 vertical 인 경우 height0dp이어야합니다.

TextView에서 줄 바꾸기를 피하려면 어떻게해야합니까? 당신이

원한다면

사용 android:singleLine="true" 대신이 '아무튼 경우 여러 줄

TextView Docs

에 포장시키기의 단일 수평 스크롤 라인에 텍스트를 제한합니다 당신의 질문에 대답 해주십시오. 조금 더 명확히하십시오. 왜냐하면 당신이 묻고있는 것에 약간 혼란 스럽기 때문입니다.

+0

먼저 가로 레이아웃으로 가중치를 사용하는 경우 너비는 0dp이어야합니다. –

+0

레이아웃 또는 텍스트 뷰에 0dp를 넣어야하는 위치는 어디입니까? –

+1

'TextView'에는 각각 'android : layout_width = "0dp"가 있어야합니다. – codeMagic

관련 문제