Kardos's Blog

Happy coding

Tuesday,April 26,2011-Eclipse_android_ApiDemo_学习4

Kardos posted @ 2011年4月25日 15:17 in 未分类 , 1241 阅读

14.App/Activity/Translucent

半透明,演示如何跳转到一个半透明的Activity.

在values中styles.xml中添加  

 <style name="Theme.Translucent" parent="android:style/Theme.Translucent">

        <item name="android:windowBackground">@drawable/translucent_background</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
    </style>
使用了style,而且自定义的style是继承自android:style/Theme.Translucent,如果不继承它,在style的name字段中是不能使用点(.)的

在Androidmainfest.xml中使用我们自定义的name为Theme.Translucent风格。

android:theme="@style/Theme.Translucent">

15.App/Activity/Translucent Blur

让对话框后面的背景模糊显示

在setContentView()方法前添加

getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

16.App/Activity/Wallpaper

获取当天背景为activity背景 android:theme="@style/Theme.Wallpaper" 

 

    <style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper">
        <item name="android:colorForeground">#fff</item>
    </style>
17.App/Alarm/Alarm Controller
 
Intent 表示一个目的,第一个参数表示所在类,第二个参数表示目标类
PendingIntent 即是一个Intent的描述
PendingIntent和Intent的区别:
PendingIntent就是一个Intent的描述,我们可以把这个描述交给别的程序,别的程序根据这个描述在后面的别的时间做你安排做的事情
换种说法Intent 字面意思是意图,即我们的目的,我们想要做的事情,在activity中,我们可以立即执行它
PendingIntent 相当于对intent执行了包装,我们不一定一定要马上执行它,我们将其包装后,传递给其他activity或application
这时,获取到PendingIntent  的application 能够根据里面的intent 来得知发出者的意图,选择拦击或者继续传递或者执行

 

 PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
                    0, intent, 0);
注意:这里是调用getBroadcast方法

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter