Android ApiDemos示例解析(18) App->Activity->Wallpaper

Wallpaper介绍一个Activity如何通过Style把系统Wallpaper作为当前Activity的背景。

这是WallpaperActivity在 AndroidManifest.xml中的定义:

<activity android:name=”.app.WallpaperActivity”

android:label=” @string/activity_wallpaper”

android:theme=”@style/Theme.Wallpaper”>

<intent-filter>

< action android:name=”android.intent.action.MAIN” />

<category android:name=” android.intent.category.SAMPLE_CODE” />

< /intent-filter>

< /activity>

@style/Theme.Wallpaper定义如下:继承系统android:style/Theme.Wallpaper,并将前景色设为白色( 这里是文字的颜色)

<!– A theme that has a wallpaper background.  Here we explicitly specify

that this theme is to inherit from the system’s wallpaper theme,

which sets up various attributes correctly. –>

<style name=”Theme.Wallpaper” parent=”android:style/Theme.Wallpaper”>

<item name=”android:colorForeground”>#fff</item>

< /style>

时间: 2024-08-29 13:14:58

Android ApiDemos示例解析(18) App-&gt;Activity-&gt;Wallpaper的相关文章

Android ApiDemos示例解析(37):App-&amp;gt;Search-&amp;gt;Query Search Results

这个例子单独运行时(从Launcher启动),这时接受到的Intent不含ACTION_SEARCH,和一个普通的Activity没有什么两样. 在例(36)时,它是作为查询处理Activity用于显示用户查询内容. SearchQueryResults 在AndroidManifest.xml定义为 Searchable Activity: <intent-filter> <action android:name="android.intent.action.SEARCH&q

Android ApiDemos示例解析(35):App-&amp;gt;Preferences-&amp;gt;Advanced preferences

前篇文章Android ApiDemo示例解析(31):App->Preferences->Launching preferences 中用到了Advanced preferences 中定义的AdvancedPreferences. 本篇具体介绍AdvancedPreferences, 这个例子称为Advanced ,是因为 它涉及到了自定义Preference, 并在一个工作线程中刷新某个Preference的值. Preference 为显示在 PreferenceActivity (一

Android ApiDemos示例解析(43):App-&amp;gt;Service-&amp;gt;Remote Service Controller

Remote Service Controller 和使用Local Service的Android ApiDemo示例解析(40):App->Service->Local Service Controller 都是使用Service的"Started" 模式,RemoteService在 AndroidManifest.xml中的定义如下: <service android:name=".app.RemoteService" android:pr

Android ApiDemos示例解析(30) App-&amp;gt;Preferences-&amp;gt;Preferences from XML

我们在前面的例子Android ApiDemo示例解析(9):App->Activity->Persistent State 介绍了可以使用Shared Preferences来存储一些状态,Shared Preferences更一般的用法是用来存储一些应用程序偏好(设置). 包 android.preference 提供了很多类可以方便应用程序来显示和设置应用相关的偏好.当然你可以使用自定义的UI来配置这些程 序偏好.但使用android.preference中定义的类可以给用户一个统一的U

Android ApiDemos示例解析(14) App-&amp;gt;Activity-&amp;gt;Save &amp;amp; Restore State

Save & Restore State与之前的例子Android ApiDemo示例解析(9):App->Activity->Persistent State 实现的 UI类似,但功能和实现方法稍有不同.(9)是通过Shared Preferences 和 Activity 的onPause() ,和onResume()来保持UI中 EditText 的值.本例是通过onSaveInstanceState(Bundle savedBundle) 来实现保持UI状态. 和onPause

Android ApiDemos示例解析(21) App-&amp;gt;Device Admin

Device Admin示例介绍了类DeviceAdminReceiver,DevicePolicyManager和ActivityManager. 类 DevicePolicyManager 用于管理Android设备定义的一些策略,主要指密码定义的长度,密码是否要含大写字母,小写字母等设 置密码需要满足的规范,锁定设备或是清除所有用户数据,这个类一般需要配合DeviceAdminReceiver来使用. DeviceAdminReceiver派生于BroadcastReceiver,可以接受

Android ApiDemos示例解析(13) App-&amp;gt;Activity-&amp;gt;Reorder Activities

Reorder Activities 示例有四个相关的Activitives: ReorderOnLaunch, ReorderTwo,ReorderThree, ReorderFour.其中ReorderOnLaunch为主Activity,ReorderOnLaunch启动ReorderTwo ,ReorderTwo启动 ReorderThree,ReorderThree启动 ReorderFour. 这时在Activity的"back stack"有如下状态: ReorderFo

Android ApiDemos示例解析(10) App-&amp;gt;Activity-&amp;gt;QuickContactsDemo

QuickContactsDemo示例介绍了如果使用Content Provider来访问Android系统的Contacts 数据库. Content Provider为不同应用之间共享数据提供了统一的接口,通过对底层数据源的抽象,Content Provider实现了应用程序代码和数 据层分离.Android平台对大部分的系统数据库都提供了对应的Content Provider接口: Browser: 读取和修改Bookmark,Browser history或Web Searches. C

Android ApiDemos示例解析(6) App-&amp;gt;Activity-&amp;gt;Dialog

在Custom Dialog中说过可以将Activity的Theme定义为Dialog风格,使得Activity看起来像是个对话框(Dialog),而 Custome Title 说明如果自定义标题栏. Dialog示例同样使用Dialog风格来显示Activity,同时为Titlebar 设置坐标的图标. DialogActivity使用Android系统定义的Dialog Theme: <activity android:name=".app.DialogActivity"