2016-07-05 11 views

Antwort

0

hier ist der Code von dem, was Sie wollen ..

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

    <LinearLayout 
     android:background="@color/colorAccent" 
     android:orientation="vertical" 
     android:layout_weight="1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    </LinearLayout> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_weight="0.3" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:background="#CDDC39" 
      android:layout_weight="1" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

     </LinearLayout> 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_weight="0.2" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

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

       <LinearLayout 
        android:background="#F8BBD0" 
        android:layout_weight="1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

       </LinearLayout> 

       <LinearLayout 
        android:background="#727272" 
        android:layout_weight="1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

       </LinearLayout> 


      </LinearLayout> 

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

       <LinearLayout 
        android:background="#212121" 
        android:layout_weight="1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

       </LinearLayout> 

       <LinearLayout 
        android:background="#E91E63" 
        android:layout_weight="1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

       </LinearLayout> 

      </LinearLayout> 

     </LinearLayout> 


    </LinearLayout> 

    <LinearLayout 
     android:background="#795548" 
     android:orientation="vertical" 
     android:layout_weight="1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    </LinearLayout> 
</LinearLayout> 

einfach kopieren ganzen Code in der XML-Datei und Sie werden wissen .. und Änderung durch Ihre Anforderung. Jetzt können Sie Textansicht, Bildansicht, Schaltfläche und andere Elemente innerhalb eines bestimmten Layouts hinzufügen. Dies ist alles über Layout-Gewicht-Attribut .. versuchen, meinen Code zu verstehen. und wenn Sie nichts über etwas wissen, dann versuchen Sie, jedes Layout Zeile für Zeile zu schreiben, und Sie werden wissen, wie es funktioniert.

+0

Vielen Dank für den Ärger. –

+0

das ist kein Problem ... sag mir einfach, du verstehst oder nicht .. –

+0

Ja, ich verstehe es sehr gut. Sie haben verschachtelte LinearLayouts verwendet. Großartig –

Verwandte Themen