2011-11-14 19 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" /> 

または、例えば、ボタンのプロパティを変更することが可能ですか?

私はokボタンを1つ持っています。たとえば、この「ok」ボタンの色を変更したいのですが、どうすればいいですか?

答えて

0

DialogPreferenceの背景を設定するには、あなたもこの方法

DialogPreference.setDialogLayoutResource(R.layout.layout1); 

res/values/colors.xml内で通常指定されたシンプルなカラーリソース、使用することができます。

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

android:background="@color/red"res/layout/layout1.xmlでこのリソースを参照してください。 (More info about setting a background

関連する問題