5

mam prosty układ:TextView „fill_parent” nie wypełnia rodzic

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:orientation="vertical" > 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Large Text" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 

</LinearLayout> 

Ale moja TextView nie bierze wszystko szerokości chociaż zrobiłem fill_parent. Jak mogę zrobić to z pełnym rozmiarem, a nie tylko z wielkością zawartości?

Odpowiedz

7

Bądź zewnętrzna LinearLayout mieć match_parent zamiast wrap_content w atrybutach android:layout_width i android:layout_height.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 
+0

Oh perfect! Jaka jest różnica między fill_parent i match_parent? –

+2

Oba są takie same, ale 'fill_parent' został zamortyzowany od czasu API 8. –

Powiązane problemy