2011-11-14 3 views
4

확장 된 DialogPreference에서 사용자 정의 스타일을 어떻게 설정할 수 있습니까? 대화 상자 환경 설정의 사용자 정의보기

public class AboutDialog extends DialogPreference { 
    public AboutDialog(Context oContext, AttributeSet attrs) 
    { 
     super(oContext,attrs); 
      //there is no such a thing like setBackground(int res_id)... 
    } 
} 

및 XML

<com.pak1.pak.About 
    android:key="key" android:title="@string/preferences_about" 
    android:dialogTitle="@string/preferences_about_title" 
    android:dialogIcon="@drawable/app_icon" android:negativeButtonText="@null" 
    android:positiveButtonText="@string/ok" /> 

또는 예에

는 버튼의 특성을 변화시킬 수있다?

하나의 확인 버튼이 있는데, 예를 들어이 '확인'버튼의 색상을 변경하고 싶습니다. 어떻게해야합니까?

답변

0

res/values/colors.xml 내에서 일반적으로 지정된 당신은 또한 방법

DialogPreference.setDialogLayoutResource(R.layout.layout1); 

및 간단한 색상 자원을 이용할 수있다 DialogPreference의 배경을 설정하려면 :

<color name="red">#ffff0000</color> 

이 리소스는 android:background="@color/red"을 통해 res/layout/layout1.xml으로 참조하십시오. (More info about setting a background)

관련 문제