2012-08-05 2 views
5

스타일을 내 스타일로 바꾸어 탭 위젯을 사용자 정의하고 싶습니다. 내가 대체하기 위하여려고하고있다 항목은 다음과 같다 :주어진 이름과 일치하는 리소스가 없습니다 : attr 'android : tabLayout'

<item name="android:tabLayout">@android:layout/tab_indicator_holo</item> 

하지만이 오류가 발생했습니다 : 어떤 자원이 그 주어진 이름과 일치 찾을 수 없습니다 : ATTR '를 안드로이드 : tabLayout'는

나는 부모를 설정 이 같은 스타일 :

<style name="customTabWidget" parent="@android:style/Widget.Holo.TabWidget"> 

프로젝트 빌드 대상 : 4.0

안드로이드는 또한 프로젝트를 청소하지만, 한 오류가 여전히 종료됩니다. 오류를 해결하는 방법?

미리 감사드립니다.

+1

'tabLayout'은 현재 비공개 속성입니다. 다음은이를 추적하는 버그입니다. https://code.google.com/p/android/issues/detail?id=65832 TabWidget을이 방법으로 사용자 정의하려면 [TabSpec.setIndicator] (http : //developer.android.com/reference/android/widget/TabHost.TabSpec.html#setIndicator (android.view.View)). – Klaus

답변

2

비슷한 문제가 발생했습니다. 솔루션의 적어도 일부는 res/values ​​/ attrs.xml에 tabLayout 속성을 추가하는 것입니다. 여기에 안드로이드-16 플랫폼에서 복사 한 TabWidget 스타일의 정의입니다 (마지막에 tabLayout 속성을 확인할 수) :

<declare-styleable name="TabWidget"> 
    <!-- Drawable used to draw the divider between tabs. --> 
    <attr name="divider" /> 
    <!-- Determines whether the strip under the tab indicators is drawn or not. --> 
    <attr name="tabStripEnabled" format="boolean" /> 
    <!-- Drawable used to draw the left part of the strip underneath the tabs. --> 
    <attr name="tabStripLeft" format="reference" /> 
    <!-- Drawable used to draw the right part of the strip underneath the tabs. --> 
    <attr name="tabStripRight" format="reference" /> 
    <!-- Layout used to organize each tab's content. --> 
    <attr name="tabLayout" format="reference" /> 
</declare-styleable> 

당신이 무시되기 때문에, 당신은 또한 변경하고자합니다 :

<item name="android:tabLayout">... 

to :

<item name="tabLayout">... 
+0

이 솔루션은 나를 도와주지 않는 것 같습니다. 내가해야 할 일은이 대답에 언급되지 않았습니까? –

+0

나는 꽤 오래 전에 그 대답을 썼다. 지금 그것을 보면서 아무 것도 떠오르지 않습니다. 죄송합니다! –

+0

그것은 해결책이 아닙니다. 컴파일 코드 만 허용됩니다. 아무것도 더. Android는 사용자 정의 속성을 모르기 때문에 사용자 정의 속성을 사용하지 않습니다. – Enyby

관련 문제