2012-10-31 5 views
3

내 응용 프로그램의 주소는 android:targetSdkVersion이며, 주소는 TabHostTabWidget이고 두 개의 탭이 있습니다. 그러나 android:minSdkVersion은 7 (Android 2.1)으로 설정됩니다.TabWidget이 Android 2.1 장치에서 올바르게 보이지 않습니다.

Android 지원 라이브러리 (android-support-v13.jar)를 사용합니다. 2.1에서 탭의 내용을 구성하는보기의 일부를 잘라내는 것처럼 보이는 것을 제외하고는 테스트 할 수 있었던 모든 곳에서 내 탭이 멋지게 보입니다. 이 문제는 에뮬레이터에서도 재현 가능합니다.

:

여기

Expected

내가 2.3 장치에서 무엇을 얻을 : 여기

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/repeat_layout" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android: /> 

     <FrameLayout> 
     ... 
     </FrameLayout> 
    </TabHost> 
</LinearLayout> 

내가 탭이보고 기대 방법은 다음과 같습니다

다음은 레이아웃 파일의 관련 섹션입니다 Unexpected

기본적으로 탭은 꼭 필요한 것보다 키가 크고 아래의 FrameLayout의 내용과 불필요하게 겹치는 것으로 보입니다.

가 해결책 : 당신이 찾고 있다면가 은 대부분 미래의 방문자를 들어, 탭 2.1에 이르기까지 모든 플랫폼에서 일관된 표시, 유일한 해결책은 사용자 정의 탭보기를 사용하는 것입니다. 여기에 훌륭한 tutorial이 있습니다.

+1

Android 2.3 또는 2.1 ?? API 7은 2.1 – Renjith

+0

입니다. 2.1 API입니다. 7. 수정 해 주셔서 감사합니다. 'tabHost'에 대한 –

+1

은 android : layout_width = "fill_parent"' –

답변

1

은 도움이

<?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:layout_width="fill_parent" android:layout_height="fill_parent" 
     android:orientation="vertical" > 

     <TabWidget android:layout_width="fill_parent" android:layout_height="wrap_content" 
      android:layout_weight="0" android:id="@android:id/tabs" 
      android:orientation="horizontal" /> 

     <FrameLayout android:layout_width="fill_parent" android:layout_height="0dp" 
      android:layout_weight="1" android:id="@+android:id/realtabcontent" /> 

    </LinearLayout> 
</TabHost> 

희망을 시도 ... !! 건배 ...

+0

매력처럼 작동하지만 'TabWidget'을 내 사용자 정의 배경과 함께 표시 할 수있는 방법이 있습니다. 첫 번째 이미지에서? 현재 2.1에서 회색과 검정색으로 표시됩니다 (두 번째 이미지 참조). –

+0

위의 해결 방법은 http://joshclemm.com/blog/?p=136에서 찾을 수 있습니다. –

관련 문제