2016-10-11 3 views
-1

Android開発に入っています。私はそれが正しいキーワードを逃しているので、それと働いたので、havent。Android Studio Menubarの作成

基本的に、画面の下部に「ホーム」、「連絡先」、「設定」などの複数のオプションを選択してメニューバーを作成して、新しいアクティビティを開く必要があります。

ImageButtonsを使用するよりも、このメニューバーを作成する良い方法はありますか?

グリーティング、

+0

このhttps://developer.android.com/training/implementing-navigation/index.htmlとhttps://developer.android.com/training/design-navigation/index.html –

+0

とhttps:/ /material.google.com/patterns/navigation.html#navigation-hierarchyとhttps://material.google.com/components/tabs.html –

答えて

0

Androidの世界へようこそ。私はかなり自分自身新しいです。ここで私はあなたにアドバイスをしています。あなたはxmlを使ってLinearLayoutsボタンを使ってアクティビティを起動できます。

まず、アクティビティのxmlファイルを作成します。線形レイアウトまたは相対レイアウトであるかどうかに関係なく、新しい線形レイアウトを下にネストします。

<LinearLayout 
android:layout_width="match_parent" 
android:layout_height="64dp" 
android:orientation="horizontal" 
android:weight_sum="4"> 

    <LinearLayout 
    android:id="+id/buttonName 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:orientation="vertical"> 

     <ImageView Put your image stuff here/> 
     <TextView Put your icon title here /> 

    </LinearLayout> 

    <View 
     android:layout_width="1dp" 
     android:layout_height="match_parent" 
     android:background="your colour"/> 
<!-- Repeat these Views and vertical Linear Layouts until you have the required amount --> 
</LinearLayout> 

"buttonName"を使用して線形レイアウトへの参照を取得し、それらを下端バーボタンとして使用することができます。

これはおそらく最も洗練されたソリューションではありませんが、それは私のために働いています。

また、あるポイントでバーを非表示にする必要がある場合は、一番上の線形レイアウトにIdを付け、表示をGoneに設定します。

関連する問題