2014-06-11 2 views
1

응용 프로그램 테마와 관계없이 단추에 테마를 적용해야합니다 (프로그래밍 방식 또는 xml). 기본적으로 내가 나를 가리키는 된 발견 된 자원은 그와 함께 문제는 내가 제대로 그 일의 좋은 예를 찾을 수있다 ContextThemeWrapper를 사용하는단일보기에 테마 적용

내 XML은에서

<LinearLayout> 
<TextView> <!-- Should follow the current theme !> 
<Button> <!-- Needs to be irrespective of the theme; I need to put in the Light theme here always> 
</LinearLayout> 

있다

내에서 onCreate 나는

LayoutInflater to inflate 
getLayoutInflater().inflate .. 
TextVIew t = view.findViewById(txt); 
// How do I change this theme from code or XML 
Button b = view.findViewById(but); 

테마를 적용해야합니다. 스타일은하지 않습니다.

답변

0

이 시도

감사합니다 :

<Button 
    style="@style/MyStyle"> 

이 충분해야한다.

+1

스타일은 기본적으로 내 응용 프로그램 테마에 의해 재정의됩니다. 주제에 따라 여러 스타일이 있습니다. – user3547028