<activity android:name="MainActivity" android:theme="@style/Theme.Wallpaper" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
Activity的配置如上。。重点就是加了一个样式。。。网页有CSS/DIV ,android有样式和主题
android:theme="@style/Theme.Wallpaper"
res/values/styles.xml代码如下
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper"> <item name="android:colorForeground">#FF0099</item> </style> </resources>main.xml代码如下
<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical|center_horizontal" android:text="[email protected]"/>
package com.test.activity; import java.io.IOException; import android.app.Activity; import android.app.WallpaperManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.PorterDuff; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ImageView.ScaleType; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // Be sure to call the super class. super.onCreate(savedInstanceState); // See res/layout/wallpaper_2.xml for this // view layout definition, which is being set here as // the content of our screen. setContentView(R.layout.main); } }