Style & Theme

old/UI Design 2010. 6. 30. 16:28

1. Style

[res/values/styles.xml]

<?xml version="1.0" encoding="utf-8"?>
<resources>
 <style name="CustomStyle" parent="@android:style/TextAppearance.Medium">
  <item name="android:windowNoTitle">true</item>
  <item name="android:windowFrame">@null</item>
  </style>
</resources>

[res/layout/main.xml
<TextView
 android:id="@+id/text1" style="@style/CustomStyle"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello"
    />


2. Theme

1) Android 기본 Theme

  (1) Manifest에서 Load.

- application 전체에 적용할 때    
<application android:theme="@android:style/Theme.Dialog">

- activity에만 적용할 때
<activity android:theme="@android:style/Theme.Dialog">


  (2) 프로그램적으로 테마를 Load.

setTheme(R.style.CustomTheme);
setContentView(R.layout.main);


2) Custom Theme 또는 기본 Theme 수정.

[res/values/styles.xml]
<?xml version="1.0" encoding="utf-8"?>
<resources>
 <style name="CustomTheme" parent="@android:style/Theme.Dialog">
  <item name="android:windowNoTitle">true</item>
  <item name="android:windowFrame">@null</item>
  </style>
</resources>

'old > UI Design' 카테고리의 다른 글

Resources - Dimen, Color, 9-patch, Animation  (0) 2010.07.01
String & StyledText  (0) 2010.06.30
Notification  (0) 2010.06.17
UI 이벤트 처리  (0) 2010.06.15
style  (0) 2010.02.22
Posted by jazzlife
,