old/UI Design

Style & Theme

jazzlife 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>