1、AndroidManifest.xml

android:theme="@style/Theme.CustomDialog

样式要用:@style

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fish.helloworld"
android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" /> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.CustomDialog" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_receive" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>

2、styles.xml

<resources>

    <!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style> <!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style> <style name="Theme.CustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/filled_box</item>
</style> </resources>

3、filled_box.xml

一定放在drawable文件夹下,否在不识别

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffff8080" />
<stroke android:width="3dp" color="#ffff8080" />
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>

Android自定义样式的更多相关文章

  1. android自定义样式大全:shape,selector,layer-list,style,动画全部内容

    原文:http://keeganlee.me/post/android/20150830 以下摘取了部分内容: shape 一般用shape定义的xml文件存放在drawable目录下,若项目没有该目 ...

  2. 024 Android 自定义样式对话框(AlertDialog)

    1.AlertDialog介绍 AlertDialog并不需要到布局文件中创建,而是在代码中通过构造器(AlertDialog.Builder)来构造标题.图标和按钮等内容的. 常规使用步骤(具体参见 ...

  3. [android] 安卓自定义样式和主题

    简单练习自定义样式和主题,样式是加在View上,主题是加在Application或者Activity上 styles.xml <?xml version="1.0" enco ...

  4. Android RatingBar 自定义样式

    Android RatingBar 自定义样式 1.先定义Style: <style name="RadingStyle" parent="@android:sty ...

  5. android自定义弹出框样式实现

    前言: 做项目时,感觉Android自带的弹出框样式比较丑,很多应用都是自己做的弹出框,这里也试着自己做了一个. 废话不说先上图片: 实现机制 1.先自定义一个弹出框的样式 2.自己实现CustomD ...

  6. Android 自定义RadioButton的样式

    Android 自定义RadioButton的样式 我们知道Android控件里的button,listview可以用xml的样式自定义成自己希望的漂亮样式. 最近用到RadioButton,利用xm ...

  7. Android 自定义Button按钮显示样式(正常、按下、获取焦点)

    现在的用户对APP的外观看得很重要,如果APP内所有元件都用Android默认样式写,估计下面评论里就有一堆在骂UI丑的.今天学习自定义Button按钮样式.Button样式修改的是Button的背景 ...

  8. xamarin android checkbox自定义样式

    xamarin android checkbox自定义样式 在drawable文件在新建checkbox_bg.xml文件 <?xml version="1.0" encod ...

  9. Android开发:UI相关(一)自定义样式资源

    一.自定义样式资源:   1.在drawble中新建xml资源文件:     如果新建的xml文件没有自动放置在drawable文件夹下,就手动移动到drawable下. 2.编写样式代码: < ...

随机推荐

  1. 转_IOS开源

    http://www.csdn.net/article/2013-06-05/2815530-GitHub-iOS-open-source-projects-one 苹果App Store本身所具有的 ...

  2. centos update git(转载)

    From:http://itekblog.com/update-git-centos/ 1.下载RPMForge repo cd /tmp # bit: wget http://pkgs.repofo ...

  3. phpStudy(lnmp)集成环境安装

    phpStudy phpStudy » PHP教程 » phpStudy for Linux (lnmp+lamp一键安装包) phpStudy for Linux (lnmp+lamp一键安装包) ...

  4. 解决docker不能下载镜像

    试了很多办法.用ss,vpn,都不行. 修改 /etc/default/docker的方式貌似在 1.12不好使了.最后找到和这个办法 http://blog.csdn.net/gsying1474/ ...

  5. 第4章 管道和FIFO

    4.1 管道 管道是由pipe函数创建的,提供一个单向数据流. 头文件 #include <unistd.h> 函数原型 int pipe(int fd[2]); 返回值 成功则为0,出错 ...

  6. [ActionScript 3.0] 通过三角形获得 3D 效果

    Flash Player 10 和更高版本,Adobe AIR 1.5 和更高版本 在 ActionScript 中,使用Graphics.drawTriangles()方法执行位图转换,因为 3D ...

  7. angularJs中的隐藏和显示

    <!DOCTYPE html> <html ng-app="a2_12"> <head> <meta charset="utf- ...

  8. mybatis模板

    因为这里是说mybatis的,所以呢 servlet就不做多说了,代码也不在这里贴出来了. log4j.properties log4j.rootLogger=DEBUG,Console log4j. ...

  9. archlinux log 文件查看

    # pacman -S gnome-system-log gnome-logsextra/gnome-logs 3.12.1-1 (gnome-extra) A log viewer for the ...

  10. 一个JS定时器类

    学习js,因为函数和定时器直接的关系是非绑定的.我不能说我开启一个定时,然后拿一个变量去记录这个setInterval的返回值,这样很麻烦. 本着面向对象的思想,利用业余时间(周末在家里)写了一个类, ...