视频讲解: http://v.youku.com/v_show/id_XNDY1ODk0NjYw.html
App->Activity->Custom Dialog 例子使用Activity 来实现自定义对话框。 类CustomDialogActivity本身无任何特别之处。关键的一点是其在AndroidManifest.xml中的定义:
<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>
CustomDialogActivity使用了CustomDialog 风格(Theme)。
Android应用可以使用自定义的界面风格(Theme),Theme 为一组相关的Style定义,可以应用于某个Activity或是整个Application。使用Theme的一个好处是可以为整个应用定义统一的界面风格(统一的背景色,字体等)。
定义Theme 和定义Style一样, 必须定义在/res/values子目录下,根元素名为resources, Theme 和Style的区别在于Theme应用于Activity和Application而 Style应用于单个的View。 其定义方法是一致的。Style 定义支持 Inheritance, 也就是在定义新风格时可以基于系统定义的风格或是之前定义的风格:
如Theme.CustomDialog 定义就是基于Android的Dialog风格(parent)而只修改的WindowsBackground属性,使用了褐色背景。
<style name=”Theme.CustomDialog” parent=”android:style/Theme.Dialog”>
<item name=”android:windowBackground”>@drawable/filled_box</item>
< /style>
Activity->Custom Dialog">
从这个Demo,我们学到如下知识:
1.Android 自定义主题和风格
http://www.eyeandroid.com/thread-8369-1-1.html

2.shape和selector的结合使用:

http://www.eyeandroid.com/thread-3232-1-1.html

3.android 使用shape使android组件呈现特殊效果

http://www.eyeandroid.com/thread-3123-1-1.html

4.android:padding和android:layout_margin的区别?

http://www.eyeandroid.com/thread-1268-1-1.html

更多相关文章

  1. Android中ImageButton自定义按钮的按下效果的代码实现方法,附网上
  2. Android(安卓)Camera 模块分析(一)
  3. Android(安卓)NDK 开发教程三:Hello JNI 示例
  4. android如何阻止app_name在标题栏中闪现
  5. android 自定义控件基础之三种约束类型
  6. android listview单击事件
  7. android 关机流程详细分析
  8. android OpenGL ES 2.0
  9. Android(安卓)5.X新特性-Material Design主题

随机推荐

  1. Android(安卓)A/B System概述
  2. 图片的异步加载
  3. 自定义Radio样式配合ListView
  4. Android(安卓)自定义确认提示框,选择确认
  5. Android(安卓)repo Q&A
  6. Android使用SurfaceView画图
  7. opnefire+android登录
  8. Using Android(安卓)Debug Bridge (ADB)
  9. android资源收藏贴[持续更新]
  10. .api方案