2016-07-05 9 views
-3

私はAndroidの初心者です。だから、私はどのようにxmlのレイアウトが画像のようにこれを達成できるか知りたい。ここXMLレイアウト:このDuolingoアプリのようなxmlレイアウトを作るにはどうすればいいですか

enter image description here

+2

何を試してみましたか? – Ironman

+0

どこから始めるのか分からなかったので、自分で試してみませんでした。私はFrameLayoutとRelativelayoutの間にぶら下がっていました。 –

答えて

0

は何をしたいのコード..です

<?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> 

は自分のXMLファイルにコード全体をコピーして、あなたは...知っているとあなたの条件によって変化します。今あなたは、特定のレイアウト内のtextview、imageview、ボタンなどを追加することができます。これはレイアウトウェイト属性に関するものです。私のコードを理解しようとします。あなたが何かについて知っていない場合は、行ごとに各レイアウトを書き留めてみてください、あなたはその仕事を知っているでしょう..

+0

ありがとうございました。 –

+0

これは問題ではありません...あなたが理解しているかどうかを教えてください。 –

+0

はい、私はそれをとてもよく理解しています。ネストされたLinearLayoutsを使用しています。 Great –

関連する問題