2013-07-06 2 views
0

사용자 지정 listview 레이아웃을 설정하여 실험하고 있습니다.ListView에서 세로 방향으로 LinearLayout 설정

test.xml의은 :
enter image description here

그러다가 선형 배치의 방향을 변경할 때 수평 혼잡되는을 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="hello" 
     /> 
    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="hello 2" 
     /> 

</LinearLayout> 

이 이렇게 정상적인 보이는 I 부풀려 레이아웃이있다 다음과 같이 보입니다. 이 문제를 해결할 방법이 있습니까? 아니면 여기서 내가 뭘 잘못하고 있습니까?
enter image description here

다시이 문제를 해결하기 위해 또는 내가 잘못 여기서 뭐하고있는 방법은 무엇입니까?

+1

텍스트보기에서 android : layout_width = "wrap_content"를 사용해보십시오. Doe 앉는 것이 효과가 있니? –

+0

레이아웃 무게 – androidqq6

답변

1

"wrap_content"로 모두 TextViews '폭을 확인

당신은 수평으로 방향을 만들었습니다, 그리고 첫 번째 텍스트 뷰가 match_parent로 폭을 가지고 있기 때문에

따라서 첫 번째 텍스트 뷰의 모든 폭을 데리고 두 번째 텍스트 뷰는 이후에 올 수 없었다 .

+0

을 사용할 수 있습니다. 그것은 작동합니다! 감사! – Krimson

관련 문제