문제

나는 tabactivity 작업 중입니다.

tabcontent(framelayout) 아래에 내 tabwidget을 표시하고 싶습니다.

나는 tabwiget 탭 속성을 다음과 같이 설정하여 완료했습니다.

android:gravity="bottom"

하지만 프레임 레이아웃은 해당 탭과 정렬될 수 없습니다.

즉, 탭이 화면 하단에 표시되고 프레임 레이아웃과 겹칩니다.

그렇게하는 방법?프레임 레이아웃에 일부 높이 값을 설정하면 Android의 모든 화면에 최적화되지 않습니다.어떡해?어떤 생각???

도움이 되었습니까?

해결책

또는 다음과 같이 사용자 정의를 사용하십시오.http://code.google.com/p/androidtabs/

하단의 탭이 허용됩니다

다른 팁

뒤에 기본 개념 Tab-Activity 다음과 같이

TabHost 탭 창 보기를 위한 컨테이너입니다.이 객체에는 두 개의 하위 항목이 있습니다.사용자가 특정 탭을 선택하기 위해 클릭하는 탭 레이블 집합과 해당 페이지의 내용을 표시하는 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>

구조에 대한 안드로이드의 사례!

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

Res/Layout/Main.xml의 TabContent 및 Tabs 만 교체합니다.

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

다음 링크를 확인하십시오

탭 활동 하단에 탭을 표시하는 두 가지 방법이 있습니다.

1) 상대 레이아웃 사용 2) layout_weight 속성 사용

http://justkumar.blogspot.com/2011/09/tabs-at-bottom-of-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