2016-03-31 29 views
-1

Etkinliğin en üstünde üç başlık gerektiren bir uygulama oluşturuyorum. Onları buraya koymaya çalışırken, üstte birbirinin yanında değil, birbirinin altında bir çizgi halinde görünmezler. Sen ana görünümünün yönünü ayarlamak zorundaTextViews birbirinin üstünde görünür

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="Starters" 
    android:id="@+id/tvStarter" 
    android:layout_gravity="left" /> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="Main Course" 
    android:id="@+id/tvMain" 
    android:layout_gravity="center_horizontal" /> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="Desserts" 
    android:id="@+id/tvDessert" 
    android:layout_gravity="right" /> 
+0

Bu tam xml nedir? tam xml gönderebilir misin? –

+1

Ebeveyn düzeninin türü nedir – Sam

+0

Tasarım Sekmesini kullanıyorsanız, Görünümlerinizin hizalanması çok daha kolaydır. Ya, ya da sadece bir RelativeLayout –

cevap

0

: Bu benim xml olduğunu

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

    <!-- your TextViews --> 

</LinearLayout> 
+0

Üzgünüm kullanmıyorsunuz, bu yüzden yönlendirme "yatay" olmalıdır – ARP

0

Bu yararlı olacaktır:

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

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="Starters" 
    android:id="@+id/tvStarter"/> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="Main Course" 
    android:id="@+id/tvMain" /> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="Desserts" 
    android:id="@+id/tvDessert" /> 

</LinearLayout> 
İlgili konular