2013-09-22 18 views
5

私はアンドロイドアプリケーションに画面の下部にタブが付いている方法を探していました。Android - 画面の下部にあるタブ

スタイルとテーマのセクションでAndroidデベロッパーのウェブサイト上で、彼らは私が何をしようとしています何の正確な例を持っているように見える、しかし、彼らはそれが必要な本のまともな例を提供するために見つけることができませんでした:

enter image description here

ウェブ上に見つかったヒント/解決策はすべて失敗しています。私はいつも誰もがこれを達成するためにどのような手掛かりを持っています

enter image description here

:-(タブは非常にアプリケーション名の横に画面の上部に置き忘れている以下のバット醜いレイアウトを得るように見えますか?

は、任意のヒントを事前にどうもありがとうございます

+0

を行うことができます。 Androidデベロッパーガイド(http://developer.android.com/guide/topics/ui/actionbar.html)で詳しく読むことができます。 – Ridcully

+0

@Wesley、これは 'Split Action Bar'ビューの機能です。あなたは良い例を見つけることができます。 'Android Manifest'に属性を定義する必要があります。 –

答えて

11

を、私はこれらの例があなたに有用であろうと思います!ここでAndroid Bottom tab bar exampleTHIS

+5

これは理論的に質問に答えるかもしれませんが、答えの本質的な部分をここに含めて参照するためのリンクを提供することが望ましいでしょう(http://meta.stackoverflow.com/q/8259)。 – Keelan

1

私はあなたが間違ったキーワードを使って検索しているので、あなたがあなたの問題のために十分なを検索していないと思います。

4メニューと5オーバーフローメニューとトップアクションバーで、上があるあなたはGmailアプリの下部にある第一の画像に表示されている

あなたがマニフェストに単純なプロパティを使用して下部のメニューを配置することができます

。アクションバーにこのよう

android:uiOptions="splitActionBarWhenNarrow"

を示す主な活動の1つの行:

<activity 
    android:name="com.example.HomeActivity" 
    android:screenOrientation="portrait" 
     android:uiOptions="splitActionBarWhenNarrow" 
    android:theme="@style/Theme.Sherlock.Light" > 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 

     <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
</activity> 
0

その非常にシンプルな....我々は

<?xml version="1.0" encoding="utf-8"?> 
<TabHost 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:padding="5dp"> 
     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 
     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:padding="5dp" /> 
    </LinearLayout> 
</TabHost> 

しかし、我々は

を使用ボトムタブバー内を使用し、単純なタブバーの場合

**

<?xml version="1.0" encoding="utf-8"?> 
<TabHost 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <RelativeLayout 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent"> 
     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_alignParentBottom="true" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 
     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:padding="5dp" /> 
    </RelativeLayout> 
</TabHost>** 

主なものは、私が使用し

android:layout_alignParentBottom=”true”; 
1

ですboのlocateタブのこのレイアウト画面のttom:コードの

?xml version="1.0" encoding="utf-8"?> 
<TabHost 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="0dp" 
      android:layout_height="0dp" 
      android:layout_weight="0"/> 
     <FrameLayout 
      android:id="@+android:id/realtabcontent" 
      android:background="@drawable/bg_main_app_gradient" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1"/> 
     <TabWidget 
      android:id="@android:id/tabs" 
      android:background="#EAE7E1" 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="0"/> 
    </LinearLayout> 
</TabHost> 

がexamle:https://stackoverflow.com/a/23150258/2765497

0

私は同じことをしようとしているあなたの質問に出くわしたが、しかし、アンドロイド開発のガイドラインに従って、あなたは一番下にタブバーを持つべきではありません、これはiOSの機能です...

Android Development Standards

+0

面白いのは、自分のGmailアプリケーションのメニューが下部にあるということです。 – Han

0

ので、あなたは少し混乱下のバーを持っているようです。それはタブバーではありません。下のバーは、アクションのためのもので、画面をナビゲートするものではありません。たとえば、上に投稿したGmailアプリのスクリーンショットでは、下のバーで、メールの作成、検索、タグ、更新などを行うことができます。参照:

技術的には、これらのボタンはユーザーを他の画面にナビゲートしますが、タブバーは通常、画面を切り替えるために使用されます。たとえば、カテゴリ別にコンテンツを表示します。

ええと、最近のGmailアプリでは、これらのアクションボタンが一番上に表示されています。一口...

+0

このリンクは質問に答えるかもしれませんが、ここで答えの重要な部分を含めて参考にしてください。リンクされたページが変更された場合、リンクのみの回答は無効になります。 –

+0

チップをありがとう。リンクは参照用です。 – Vasim

1

タブの下部にはお勧めしません。

は、アンドロイドから以下の公式デザインパターンのガイドを参照してください
そして、私はここにアップデートを投稿したかったセクション「下のタブ・バーを使用しないでください」

http://developer.android.com/design/patterns/pure-android.html

+0

いいえ、これはAndroid/Googleで推奨されていますが、これはレイアウトデザイナーにとっては本当に馬鹿げています。結局のところ、タブの使用は本当に悪くありません。 – Raptor

+5

最新のGoogle+アプリには、画面の下部にタブが表示されています。これは、使用しないように指示されています。 – moyheen

+3

http://www.theverge.com/2016/3/15/11236152/material-design-update-bottom-navigation-bar –

1

を探します。 Bottom nav bars are now Android Canon.主なテイクは次の通りです:

1)下部ナビゲーションバーは、3〜5個のアイコンのみを使用してください。それ以下であれば、tabsを使用してください。それ以上の場合は、スクロール可能なタブを使用します(同じリンク上にページを表示)。

2)下部ナビゲーションバーとタブを一緒に使用しないようにしてください。また、両者の責任が明確に分かれていることを確認してください。

3)下のナビゲーションバーがナビゲーションために使用されるべきではないアクション下部のナビゲーションの導入によりそれらのためActionBar

関連する問題