2013-01-08 1 views
0

우리는 Android 개발에 매우 ​​익숙합니다.안드로이드 4.2에서 TabHost - 탭에 표시되지 않는 아이콘과 색상

우리는 탭보기를 사용하여 활동을 구현하고 있습니다. 우리가 겪고있는 문제는 탭 자체의 아이콘과 적절한 색상이 Jelly Bean (Android 4.2)에 제대로 표시되지 않는다는 것입니다. 그러나 Gingerbread와 같은 초기 API 레벨에서는 제대로 표시됩니다.

참고 : 원래 비추천 TabActivity 클래스를 사용하여보기를 만들었습니다. 그러나, 내가 말할 수있는 한, 이것을하는 "더 새로운"방법은 옛 것과 다르지 않아야합니까? 내가 틀렸다면 나를 바로 잡아주세요. 탭 자체가 젤리 빈에 모습을

public class MainTabActivity extends FragmentActivity implements TabHost.TabContentFactory 
    private TabHost tabHost; 
    // other instance variables ... 

    @Override 
    public void onCreate(Bundle savedInstanceState){ 
     super.onCreate(savedInstanceState); 
     tabHost = (TabHost)findViewById(android.R.id.tabhost); 
     tabHost.setup(); 

     TabSpec loginTabSpec = tabHost.newTabSpec(GlobalConstants.LOGIN_ACTIVITY); 
     loginTabSpec.setIndicator("Settings", getResources().getDrawable(R.drawable.ic_action_settings_gear)); 
     loginTabSpec.setContent(this); 

     TabSpec mainTabSpec = tabHost.newTabSpec(GlobalConstants.MAIN_ACTIVITY); 
     mainTabSpec.setIndicator("Lone Worker", getResources().getDrawable(R.drawable.ic_action_settings_phone)); 
     mainTabSpec.setContent(this); 

     tabHost.addTab(mainTabSpec); 
     tabHost.addTab(loginTabSpec); 
    } 

이것은 : 여기

<?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" 
    android:background="@color/Black"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:padding="5dp"> 

     <include layout="@layout/logo_bar"/> 

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

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" > 
     </FrameLayout> 
    </LinearLayout> 
</TabHost> 

이 관련 (I 희망) 활동 코드 :

은 탭 호스트 레이아웃을 포함하는 XML이다 (나쁜 버전) : enter image description here

그리고 마지막으로, 이것은 진저 브레드에 ... 좋은 버전처럼 보일 것입니다 : enter image description here

다시 반복 할 때 : 탭의 배경색이 검은 색 (일반적으로 멋진 푸른 색일 때)이며 불량 스크린 샷에서 알기는 어렵지만 어느 탭의 아이콘이 보이지 않습니다. 젤리 콩에 최대. 문제가 충분히 설명되기를 바랍니다. 제가 아무것도 남겨 두지 않았다면 알려주세요. 미리 감사드립니다. 당신은 내가 당신이 어떤 텍스트가 표시되지 않는 이유를 의심

setIndicator(CharSequence label, Drawable icon) 

를 사용하는 경우 안드로이드의 최신 버전에서 어떤 이유를 들어

+0

이 유 PLZ 나에게 말해 또는 인도 할 수 ... 방법을 제공합니다 4.2에서 탭 사이의 여백 .. 탭에서 4.1 마진에 잘 작동하고 4.2에서 동일한 프로젝트를 실행하면 탭 사이의 여백이 사라지고 모든 탭이 같은 공간을 차지합니다. plz 가이드 나에게 이것에 대한 몇 가지 해결책이 있다면. .. 감사합니다 –

+0

@NipunGogia 잘 모르겠다. 탭 사이에 여백을 두지 않으려 고하지 않았다. 내 질문은 이것과 관련이 없으므로 여기에 자신 만의 질문을 게시하고 싶을 수도 있습니다. –

+0

ok thanks .......... –

답변