質問

私はタブアクティビティに取り組んでいます。

タブコンテンツ(フレームレイアウト)の下にタブウィジェットを表示したいです。

tabwigetのタブ属性を次のように設定してそれを行いました

android:gravity="bottom"

しかし、フレームレイアウトはそれらのタブと揃えることができません。

つまり、タブは画面の下部に表示され、フレームレイアウトと重なっています。

どうやってするか?フレームレイアウトに高さの値を設定すると、Android のすべての画面に最適化されません。私に何ができる?何か案が???

役に立ちましたか?

解決

あるいは単にからカスタムいずれかを使用します。 http://code.google.com/p/androidtabs/する

が底のタブを可能にする

他のヒント

基本的なコンセプトは、 Tab-Activity 次のように

TabHost タブ付きウィンドウ ビューのコンテナです。このオブジェクトは 2 つの子を保持します。ユーザーがクリックして特定のタブを選択する一連のタブ ラベルと、そのページのコンテンツを表示する FrameLayout オブジェクトです。

個々の要素は通常、子要素自体に値を設定するのではなく、このコンテナ オブジェクトを使用して制御されます。

TabWidget 親のタブ コレクション内の各ページを表すタブ ラベルのリストを表示します。このウィジェットのコンテナ オブジェクトは TabHost です。ユーザーがタブを選択すると、このオブジェクトはコンテナ TabHost にメッセージを送信して、表示ページを切り替えるように指示します。コンテナー 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" >

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >
    </FrameLayout>

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="-3dip"
        android:layout_weight="0" >
    </TabWidget>
  </LinearLayout>

  </TabHost>

救助にAndroidの例!

http://developer.android.com/resources/tutorials /views/hello-tabwidget.htmlする

ただ、スワップtabcontentおよび解像度/レイアウト/ main.xmlのタブます:

   <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp">
   <FrameLayout
            android:id="@android:id/tabcontent"
            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" />

   </LinearLayout>

次のリンクをチェックしてください。

タブの活動の下部にあるタブを表示するには、2つの方法があります。

1)相対レイアウトを使用  2)Layout_weight属性を使用する

ます。http://justkumar.blogspot。 COM / 2011/09 /タブ・アット・ボトム・オブ・tabactivity-by.htmlする

これを確認してください。

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
android:id="@android:id/tabhost">
<LinearLayout android:id="@+id/LinearLayout01"
android:orientation="vertical" 
android:layout_height="fill_parent"
android:layout_width="fill_parent">

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_height="fill_parent"
android:layout_width="fill_parent">

    <TabWidget 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:layout_gravity="bottom" 
android:id="@android:id/tabs">
</TabWidget>
</FrameLayout>

</LinearLayout>

これは下のタブのためのコードである

<TabWidget
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_gravity="bottom" 
android:background="#0000"
android:id="@android:id/tabs"
/>



  "android:layout_gravity="bottom" 
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top