2016-06-21 6 views
0

私はAndroid開発が初めてです。私はリンクの下で私が提供したイメージに似たレイアウトを作成したいと思います。リンクで提供されている画像と似たレイアウトを作成する方法android

私のアンドロイドアプリケーションで作成したいレイアウトイメージを表示するには、下のリンクをクリックしてください。

http://i.stack.imgur.com/nv2TH.gif

これはまだ提供された画像に基準を満たしていない私が書いたレイアウトです。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/relativeLayout" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<ImageView 
    android:id="@+id/imageView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/anim" 
    android:scaleType="centerCrop" /> 

<TextView 
    android:id="@+id/musicTitle" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="20dp" 
    android:text="Music Title" 
    android:textColor="#FFFFFF" 
    android:textSize="20sp" /> 

<TextView 
    android:id="@+id/musicArtistName" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/musicTitle" 
    android:layout_centerHorizontal="true" 
    android:text="Singer Name - Artist Here" 
    android:textColor="#FFFFFF" 
    android:textSize="14sp" /> 

どのように私はこれを実装する方法を知りたいのxml layout.Iのこのタイプを作成するのですか?ありがとうございました。

答えて

0

は、アイデアは、あなたが使用する必要がありますビューを理解する必要がAndroidのレイアウトを設計するときの重量の合計でレイアウトを作成し、それぞれの子供に重量

<?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" 
     android:weightSum="4"> 

     <RelativeLayout 
      android:id="@+id/relativeLayout" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="2"> 

     <ImageView 
      android:id="@+id/imageView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:src="@drawable/banner_broken_image" 
      android:scaleType="centerCrop" /> 

     <TextView 
      android:id="@+id/musicTitle" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="20dp" 
      android:text="Music Title" 
      android:textColor="#FFFFFF" 
      android:textSize="20sp" /> 

     <TextView 
      android:id="@+id/musicArtistName" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/musicTitle" 
      android:layout_centerHorizontal="true" 
      android:text="Singer Name - Artist Here" 
      android:textColor="#FFFFFF" 
      android:textSize="14sp" /> 

     </RelativeLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1.5" 
      android:background="@android:color/white"/> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="0.5" 
      android:background="@android:color/black"/> 

    </> 
+0

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

0

の一部を与えることです以下を試してみてください。あなたがリンクされている画像で

、上から下へ、があります。

  • ImageViewのは、この
  • カスタムビュー経由で他のユーザーのTextViewで、あなた自身を実装するか、ライブラリを検索する必要がありますこれは、3つのボタン(IMAGEBUTTON)、プレイヤーの制御開始時に2のTextViewと

  • プログレスと音

  • のLinearLayout(水平方向)を示し、最後は、曲の進行

  • 下部のナビゲーションバーこの分析は今、あなたを助け

希望と次回は、あなたは、レイアウトを参照してください!

+0

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

+0

問題がない場合は、「受け入れ済み」とマークしてください;) –

関連する問題