2014-09-10 2 views
2

내 Preference 카테고리의 색상을 변경하고 기본 수평 라인을 파란색으로 변경하고 싶습니다. 이것이 가능한가? android의 기본 카테고리에 대한 텍스트 색상 및 수평 색상 변경

나는 함께 환경 설정의 테마를 설정하려고 다음

<style name="myPreferenceTheme" parent="@style/AppBaseTheme"> 
    <item name="android:textColor">@color/blue</item> 
</style> 

하지만이 출력으로 다음있어 :

enter image description here

내 preference.xml은 다음과 같습니다 :

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > 
<PreferenceCategory 
    android:title="ACCOUNT" > 
    <Preference 
     android:key="googleAccount" 
     android:summary="" 
     android:title="Google Account" > 
    </Preference> 
    <Preference 
     android:key="signoutmenu" 
     android:summary="" 
     android:title="Sign out" > 
    </Preference> 
</PreferenceScreen> 

누가이 문제를 해결할 수 있습니까? 위의 스크린 샷과 같은 소송을 제기 하시겠습니까?

감사합니다.

+0

아니고 대답. 하지만 도움이 될 수도 있습니다. http://stackoverflow.com/questions/6297635/custom-preferencecategory-headings –

답변

2

사용자 정의 PreferenceCategory를 만들고 "onBindView"메소드에서 제목 색상을 변경할 수 있습니다 (이 예에서 카테고리 제목 색상은 빨간색으로 변경됨).

public class MyPreferenceCategory extends PreferenceCategory { 

    public MyPreferenceCategory(Context context) { 
     super(context); 
    } 

    public MyPreferenceCategory(Context context, AttributeSet attrs) { 
     super(context, attrs); 
    } 

    public MyPreferenceCategory(Context context, AttributeSet attrs, 
     int defStyle) { 
     super(context, attrs, defStyle); 
    } 

    @Override 
    protected void onBindView(View view) { 
     super.onBindView(view); 
     TextView titleView = (TextView) view.findViewById(android.R.id.title); 
     titleView.setTextColor(Color.RED); 
    } 

}

This link has the original solution from where I got this answer