1.테마 적용하는 방법
(styles.xml)
<resources>
<style name="CustomTitleTheme" parent="android:Theme">
<item name="android:windowTitleSize">50dip</item>
<item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item>
</style>
<style name="WindowTitleBackground" parent="android:WindowTitleBackground">
<item name="android:background">@android:color/transparent</item>
</style>
</resources>
타이틀바 높이를 50dip로 배경은 투명하게 스타일 정의
(AndroidManfest.xml)
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:theme="@style/CustomTitleTheme">
안드로이드 매니페스트에 정의한 테마적용
public class CustomTitle extends Activity {
/**
* Initialization of the Activity after it is first created. Must at least
* call {@link android.app.Activity#setContentView(int)} to
* describe what is to be displayed in the screen.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.custom_title);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_1);
.......
}
}
액티비티에 커스텀 타이틀 레이아웃을 적용하면 끝
댓글 없음:
댓글 쓰기