1

여러 가지 색상 테마로 Android 앱을 스킨하고 싶습니다. 이 가이드/도구 나 기본적인 theme.xmltheme.xml 및 style.xml로 PopupMenu 및 AlertDialog의 스타일을 지정하는 방법

style.xml을 생성하는 데 도움이하지만 난이 의 PopupMenu의 스타일을 알아낼 질수에 AlertDialog 헤더?

내 앱 테마로 간소화하기 위해 색만 바꾸고 싶습니다!

예 :
before, taken from: developer.android.com/images/ui/dialogs.png

내가 Theme.Holo을 사용하고 after, taken from: developer.android.com/images/ui/dialog_custom.png


과 같이 안드로이드 SDK 21.1 RC3/도구 16.0. 나는 스타일과 테마를 많이 해봤지만 아무것도

답변

0
public class AlertDialogThemed extends AlertDialog { 
public AlertDialogThemed(Context context) { 
    super(context); 
} 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    final Resources resources = getContext().getResources(); 
    final int color = resources.getColor(R.color.dialog_color); 

    final View title = findViewById(resources.getIdentifier("alertTitle", "id", "android")); 
    if (title != null) { 
     ((TextView) title).setTextColor(color); 
    } 

    final View titleDivider = findViewById(resources.getIdentifier("titleDivider", "id", "android")); 
    if (titleDivider != null) { 
     titleDivider.setBackgroundColor(color); 
    } 
} 

}

을 일했다
관련 문제