[code]AndroidManifest.xml[/code]
- 커스텀 윈도우를 만들기 위해서는 style 정보를 설정해야 하는데 AndroidManifest.xml 내에 theme 어트리뷰트에서 적용할 style 파일의 정보를 얻을 수 있다.
- theme 에 Theme.CustomDialog 로 선언된 내용은 /res/values/styles.xml 에 해당 정보가 들어가 있다.
- style 내의 custom dialog 내에서는 해당 요소에 대해서 세부 항목을 설정할 수 있고 style element 내의 item 으로 설정한다. 이 정보들은 res/drawable 내에 존재하게 되며 @drawable/filled_box 식으로 표현되고 파일명이 filled_box.xml 로 된다.
android:theme="@style/Theme.CustomDialog"
<activity android:name=".app.CustomDialogActivity"
android:label="@string/activity_custom_dialog"
android:theme="@style/Theme.CustomDialog">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
[code]/res/values/styles.xml[/code]
<!-- A theme for a custom dialog appearance. Here we use an ugly custom frame. -->
<style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/filled_box</item>
</style>
[code]/res/drawable/filled_box.xml[/code]
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#f0600000"/>
<stroke android:width="3dp" color="#ffff8080"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
[code]java[/code]
package com.example.helloworld;
import android.app.Activity;
import android.os.Bundle;
import com.example.helloworld.R;
public class helloworld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
- 커스텀 윈도우를 만들기 위해서는 style 정보를 설정해야 하는데 AndroidManifest.xml 내에 theme 어트리뷰트에서 적용할 style 파일의 정보를 얻을 수 있다.
- theme 에 Theme.CustomDialog 로 선언된 내용은 /res/values/styles.xml 에 해당 정보가 들어가 있다.
- style 내의 custom dialog 내에서는 해당 요소에 대해서 세부 항목을 설정할 수 있고 style element 내의 item 으로 설정한다. 이 정보들은 res/drawable 내에 존재하게 되며 @drawable/filled_box 식으로 표현되고 파일명이 filled_box.xml 로 된다.
android:theme="@style/Theme.CustomDialog"
<activity android:name=".app.CustomDialogActivity"
android:label="@string/activity_custom_dialog"
android:theme="@style/Theme.CustomDialog">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
[code]/res/values/styles.xml[/code]
<!-- A theme for a custom dialog appearance. Here we use an ugly custom frame. -->
<style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/filled_box</item>
</style>
[code]/res/drawable/filled_box.xml[/code]
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#f0600000"/>
<stroke android:width="3dp" color="#ffff8080"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
[code]java[/code]
package com.example.helloworld;
import android.app.Activity;
import android.os.Bundle;
import com.example.helloworld.R;
public class helloworld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
'Android' 카테고리의 다른 글
listview (0) | 2013.10.08 |
---|---|
auto import (0) | 2013.10.08 |
dialog (0) | 2013.10.08 |
capture (0) | 2013.10.08 |
Unexpected end tag string (0) | 2013.10.07 |