怎样制作android 3d桌面动态桌面

智能手机教程子分类怎么制作安卓系统手机的动态壁纸_百度知道
怎么制作安卓系统手机的动态壁纸
我想问下我要下载什么软件才能制作成动态壁纸.3.6的系统:三星 I9020(Nexus S)问题类型:系统辅助我想用一个20秒的视频短片制作成手机的动态壁纸,我的手机是三星I9020,安卓2?谁有链接的能给我个我的手机
提问者采纳
反正那边应用蛮多的,楼主去那边搜一下、导航器和游戏软件都从那下的,我用的不少音乐播放器安智市场里应该有这类app吧
参考资料:
相关专业回答
可以用PHOTO SHOP 处理
例如 要把图片处理为90*120,可以进行以下步骤:
1、打开PHTOSHOP
文件菜单中打开照片。
2、在你的照片的上面 右击 标题栏,选择实际大小,宽度90像素,一定要选择约束比例。
3、选择 左边的缩放工具(放大镜),在图像上方选择实际像素,选择最大化 。
裁剪工具(左下第三份个)
在宽度栏填写90 px,高度120px
...
其他类似问题
9人觉得有用
为您推荐:
其他2条回答
动态壁纸给手机带来一个变幻的缤纷世界,安卓智能手机上的动态壁纸种类繁多,但却没有更个性化的设置,没法拿张普通的JPG、PNG静态图片就设为壁纸那样,用GIF等动态图片充当动态壁纸。那么有没有办法自己DIY个性化的动态壁纸呢?其实,我们甚至不使用任何工具软件就能够制作出一张安卓动态壁纸,只要访问OwnSkin(),在首页上选择“Android手机动态壁纸”进入(如图1),注册OwnSkin用户并登录就可以开始动工了。点击导航栏上的“自制动态壁纸”按钮,打开动态壁纸制作页面,首先要根据自己手机屏幕大小设置准确的分辨率(如图2)。接着正式进入制作步骤。第一次制作动态壁纸时,点击左下角的“自己做一个”按钮,然后从电脑中保存的图片里选择一张作为动态壁纸的背景。待导入图像后,拖动选框的四角裁切图片,完成后...
里面自己学着做做看呗
您可能关注的推广
安卓系统的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁android动态壁纸的制作
作者:Android开发网原创
& 对于Android 2.1来说Live
Wallpapers动态壁纸的加入为Android桌面加入了更好的动态效果。如何开发一个Android动态桌面呢?
下面Android123给大家一个详细的步骤创建属于你自己的Live Wallpaper吧。
& 1. 首先我使用Eclipse创建一个标准的Android工程这里package
name我们使用cn.com.android123.cwj,然后进入工程的/res/文件夹,删除layout这个文件夹,当然里面的main.xml也会被删除的,对于Live
Wallpaper来说传统的布局文件是不需要的。
类似AppWidget一样,我们可以加入动态壁纸的设置界面,我们在/res/文件夹中新建一个名为xml的文件夹,新建一个utf8编码的xml文件,名为livewallpaper.xml,内容为
version="1.0" encoding="utf-8"?&
& &wallpaper
xmlns:android="/apk/res/android"
&android:settingsActivity="cn.com.android123.cwj.LiveWallpaperSettings"
&android:thumbnail="@drawable/icon"/&
这里我们可以看到上面的节点名为wallpaper,而设置的界面为
cn.com.android123.cwj.LiveWallpaperSettings&&这个Activity,而在添加动态壁纸时显示图标为/res/drawable/icon
这个文件,同时我们再创建一个xml文件用于LiveWallpaperSettings这个Activity的布局,我们起名为livewallpaper_settings.xml内容为
& &?xml version="1.0"
encoding="utf-8"?&
&PreferenceScreen xmlns:android="/apk/res/android"
&android:title="@string/livewallpaper_settings"
&android:key="livewallpaper_settings"&
&&ListPreference
&&android:key="livewallpaper_testpattern"
&&android:title="标题"
&&android:summary="简单描述"
&&android:entries="@array/livewallpaper_testpattern_names"
&&android:entryValues="@array/livewallpaper_testpattern_prefix"/&
&&CheckBoxPreference
android:key="livewallpaper_movement"
&&android:summary="动态描述"
&&android:title="动态标题"
&&android:summaryOn="动态测试"
&&android:summaryOff="静止测试"/&
&/PreferenceScreen&
创建一个名为LiveWallpaper的类作为动态壁纸的主类,从WallpaperService父类继承,这里我们可以像写标准Android服务那样开发,代码为
& public class LiveWallpaper extends
WallpaperService
&public static final
String&SHARED_PREFS_NAME&=
"livewallpapersettings";
&@Override
&public void onCreate()
&&super.onCreate();
&@Override
&public void onDestroy()
&&super.onDestroy();
&@Override
&public Engine onCreateEngine()
&&return new
TestPatternEngine();
&class TestPatternEngine extends Engine
implements
&&&SharedPreferences.OnSharedPreferenceChangeListener
&&private final
Handler&&mHandler&&=
new Handler();
float&&&&mTouchX&&&=
float&&&&mTouchY&&&=
&&private final
Paint&&&mPaint&&&=
new Paint();
&&private final
Runnable&&mDrawPattern&=
new Runnable()
&&&&&&&&&&&&&{
&&&&&&&&&&&&&&public
void run()
&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&drawFrame();
&&&&&&&&&&&&&&}
&&&&&&&&&&&&&};
boolean&&&&mV
SharedPreferences&mP
Rect&&&&mRectF
Rect[]&&&&mColorR
int[]&&&&rectC
int&&&&&mRectC
&&// private
Rect&&&&mGradientR
&&GradientDrawable&&&mG
boolean&&&&mHorizontal&&=
int&&&&&mFrameCounter&=
boolean&&&&mMotion&&&=
String&&&&mShape&&&=
&&TestPatternEngine()
&&&final Paint
paint = mP
&&&paint.setColor(0xffffffff);
&&&paint.setAntiAlias(true);
&&&paint.setStrokeWidth(2);
&&&paint.setStrokeCap(Paint.Cap.ROUND);
&&&paint.setStyle(Paint.Style.STROKE);
&&&mPreferences
= LiveWallpaper.this.getSharedPreferences(SHARED_PREFS_NAME,
&&&mPreferences.registerOnSharedPreferenceChangeListener(this);
&&&onSharedPreferenceChanged(mPreferences,
&&public void
onSharedPreferenceChanged(SharedPreferences prefs,
&&&&String
&&&mShape =
prefs.getString("livewallpaper_testpattern", "smpte");
&&&mMotion =
prefs.getBoolean("livewallpaper_movement", true);
&&&readColors();
&&private void readColors()
&&&int pid =
getResources().getIdentifier(mShape + "colors", "array",
getPackageName());
&&&rectColor =
getResources().getIntArray(pid);
&&&mRectCount =
rectColor.
&&&mColorRectangles
= new Rect[mRectCount];
&&&System.out.println("mRectCount
"+mRectCount);
&&&initFrameParams();
&&@Override
&&public void
onCreate(SurfaceHolder surfaceHolder)
&&&super.onCreate(surfaceHolder);
&&&setTouchEventsEnabled(true);
&&@Override
&&public void onDestroy()
&&&super.onDestroy();
&&&mHandler.removeCallbacks(mDrawPattern);
&&@Override
&&public void
onVisibilityChanged(boolean visible)
&&&mVisible =
&&&&drawFrame();
&&&&mHandler.removeCallbacks(mDrawPattern);
&&@Override
&&public void
onSurfaceChanged(SurfaceHolder holder, int format,
width, int height)
&&&super.onSurfaceChanged(holder,
format, width, height);
&&&initFrameParams();
&&&drawFrame();
&&@Override
&&public void
onSurfaceCreated(SurfaceHolder holder)
&&&super.onSurfaceCreated(holder);
&&@Override
&&public void
onSurfaceDestroyed(SurfaceHolder holder)
&&&super.onSurfaceDestroyed(holder);
&&&mVisible =
&&&mHandler.removeCallbacks(mDrawPattern);
&&@Override
&&public void
onOffsetsChanged(float xOffset, float yOffset, float xStep,
yStep, int xPixels, int yPixels)
&&&drawFrame();
&&&@Override
&&public void
onTouchEvent(MotionEvent event)
(event.getAction() == MotionEvent.ACTION_MOVE)
&&&&mTouchX
= event.getX();
&&&&mTouchY
= event.getY();
&&&&mTouchX
&&&&mTouchY
&&&super.onTouchEvent(event);
&&void drawFrame()
SurfaceHolder holder = getSurfaceHolder();
&&&Canvas c =
= holder.lockCanvas();
(c != null)
draw something
&&&&&drawPattern(c);
&&&&&drawTouchPoint(c);
&&&finally
(c != null)
&&&&&holder.unlockCanvasAndPost(c);
&&&mHandler.removeCallbacks(mDrawPattern);
(mVisible)
&&&&mHandler.postDelayed(mDrawPattern,
1000 / 25);
&&void drawPattern(Canvas
&&&c.save();
&&&c.drawColor(0xff000000);
&&&Paint paint =
new Paint();
&&&&mFrameCounter++;
(mHorizontal)
(mFrameCounter & mRectFrame.right)
&&&&&&mFrameCounter
(int i = 0; i & mRectC i++)
&&&&&&paint.setColor(rectColor[i]);
&&&&&&right
= mColorRectangles[i].right + mFrameC
&&&&&&left
= mColorRectangles[i].left + mFrameC
&&&&&&if(right
& mRectFrame.right)
&&&&&&&c.drawRect(left
- mRectFrame.right, mColorRectangles[i].top, right -
mRectFrame.right, mColorRectangles[i].bottom, paint);
&&&&&&if(left
& mRectFrame.right)
&&&&&&&c.drawRect(left,
mColorRectangles[i].top, right, mColorRectangles[i].bottom,
&&&&&pareToIgnoreCase("smpte")
&&&&&&right
=mGradientRect.right + mFrameC
&&&&&&left
= mGradientRect.left + mFrameC
&&&&&&if(right
& mRectFrame.right)
&&&&&&&mGradient.setBounds(left
- mRectFrame.right, mGradientRect.top, right - mRectFrame.right,
mGradientRect.bottom);
&&&&&&&mGradient.draw(c);
&&&&&&if(left
& mRectFrame.right)
&&&&&&&mGradient.setBounds(left,
mGradientRect.top, right, mGradientRect.bottom);
&&&&&&&mGradient.draw(c);
(mFrameCounter & mRectFrame.bottom)
&&&&&&mFrameCounter
(int i = 0; i & mRectC i++)
&&&&&&paint.setColor(rectColor[i]);
= mColorRectangles[i].top + mFrameC
&&&&&&bottom
= mColorRectangles[i].bottom + mFrameC
&&&&&&if(bottom
& mRectFrame.bottom)
&&&&&&&c.drawRect(mColorRectangles[i].left,
top - mRectFrame.bottom, mColorRectangles[i].right, bottom -
mRectFrame.bottom, paint);
&&&&&&if(top
& mRectFrame.bottom)
&&&&&&&c.drawRect(mColorRectangles[i].left,
top, mColorRectangles[i].right, bottom, paint);
&&&&&pareToIgnoreCase("smpte")
= mGradientRect.top + mFrameC
&&&&&&bottom
= mGradientRect.bottom + mFrameC
&&&&&&if(bottom
& mRectFrame.bottom)
&&&&&&&mGradient.setBounds(mGradientRect.left,
top - mRectFrame.bottom, mGradientRect.right, bottom -
mRectFrame.bottom);
&&&&&&&mGradient.draw(c);
&&&&&&if(top
& mRectFrame.bottom)
&&&&&&&mGradient.setBounds(mGradientRect.left,
top, mGradientRect.right, bottom);
&&&&&&&mGradient.draw(c);
(int i = 0; i & mRectC i++)
&&&&&paint.setColor(rectColor[i]);
&&&&&c.drawRect(mColorRectangles[i],
&&&&pareToIgnoreCase("smpte")
&&&&&mGradient.setBounds(mGradientRect);
&&&&&mGradient.draw(c);
&&&c.restore();
&&void drawTouchPoint(Canvas
&&&if (mTouchX
&= 0 && mTouchY
&&&&c.drawCircle(mTouchX,
mTouchY, 80, mPaint);
&&void initFrameParams()
&&&DisplayMetrics
metrics = new DisplayMetrics();
&&&Display
display = ((WindowManager)
getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
&&&display.getMetrics(metrics);
&&&mRectFrame =
new Rect(0, 0, metrics.widthPixels, metrics.heightPixels);
&&&int rotation
= display.getOrientation();
&&&if(rotation
== Surface.ROTATION_0 || rotation == Surface.ROTATION_180)
&&&&mHorizontal
&&&&mHorizontal
&&&System.out.println("mHorizontal
"+mHorizontal);
&&&System.out.println("mShape
"+mShape);
&&&pareToIgnoreCase("smpte")
&&&&System.out.println("mShape
== smpte");
&&&&CreateSmpte();
pareToIgnoreCase("bars") == 0)
&&&&System.out.println("mShape
== bars");
&&&&CreateBars();
&&&&System.out.println("mShape
&&&&CreateEbu();
&&private void
CreateSmpte()
&&&if(mHorizontal)
topHeight = mRectFrame.bottom * 7 / 12;
bottomHeight = mRectFrame.bottom * 3 / 4;
wideColumnWidth = mRectFrame.right / 8;
narrowColumnWidth = mRectFrame.right * 3 / 28;
&&&&mColorRectangles[0]
= new Rect(0, 0, wideColumnWidth, topHeight);
(int i = 1; i & 8; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[i - 1].right, 0, mColorRectangles[i -
1].right + narrowColumnWidth, topHeight);
&&&&mColorRectangles[8]
= new Rect(mColorRectangles[7].right, 0, mRectFrame.right,
topHeight);
(int i = 0; i & 2; i++)
middleTop = mRectFrame.bottom * (7 + i) / 12;
middleBottom = mRectFrame.bottom * (8 + i) / 12;
&&&&&mColorRectangles[i
+ 9] = new Rect(0, middleTop, wideColumnWidth, middleBottom);
&&&&&mColorRectangles[i
+ 11] = new Rect(wideColumnWidth, middleTop, narrowColumnWidth +
wideColumnWidth, middleBottom);
&&&&&mColorRectangles[i
+ 13] = new Rect(narrowColumnWidth * 7 + wideColumnWidth,
middleTop, mRectFrame.right, middleBottom);
&&&&mColorRectangles[15]
= new Rect(narrowColumnWidth + wideColumnWidth, topHeight,
narrowColumnWidth * 7 + wideColumnWidth, mRectFrame.bottom * 8 /
&&&&mGradientRect
= new Rect(mColorRectangles[15].left, mColorRectangles[15].bottom,
mColorRectangles[15].right, mRectFrame.bottom * 9 / 12);
&&&&mGradient
= new GradientDrawable(Orientation.LEFT_RIGHT, new int[] {
0xffxfffdfdfd });
&&&&mGradient.setBounds(mGradientRect);
&&&&mColorRectangles[16]
= new Rect(0, bottomHeight, wideColumnWidth,
mRectFrame.right);
&&&&mColorRectangles[17]
= new Rect(mColorRectangles[16].right, bottomHeight,
mRectFrame.right * 9 / 56 + mColorRectangles[16].right,
mRectFrame.bottom);
&&&&mColorRectangles[18]
= new Rect(mColorRectangles[17].right, bottomHeight,
mRectFrame.right * 3 / 14 + mColorRectangles[17].right,
mRectFrame.bottom);
&&&&mColorRectangles[19]
= new Rect(mColorRectangles[18].right, bottomHeight,
mRectFrame.right * 45 / 448 + mColorRectangles[18].right,
mRectFrame.bottom);
(int i = 20; i & 25; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[i - 1].right, bottomHeight,
mRectFrame.right * 15 / 448 + mColorRectangles[i - 1].right,
mRectFrame.right);
&&&&mColorRectangles[25]
= new Rect(mColorRectangles[24].right, bottomHeight,
narrowColumnWidth + mColorRectangles[24].right,
mRectFrame.bottom);
&&&&mColorRectangles[26]
= new Rect(mColorRectangles[25].right, bottomHeight,
mRectFrame.right, mRectFrame.bottom);
topHeight = mRectFrame.right * 5 / 12;
bottomHeight = mRectFrame.right / 4;
wideColumnWidth = mRectFrame.bottom / 8;
narrowColumnWidth = mRectFrame.bottom * 3 / 28;
&&&&mColorRectangles[0]
= new Rect(topHeight, 0, mRectFrame.bottom, wideColumnWidth);
(int i = 1; i & 8; i++)
&&&&&mColorRectangles[i]
= new Rect(topHeight, mColorRectangles[i - 1].bottom,
mRectFrame.right, narrowColumnWidth + mColorRectangles[i -
1].bottom);
&&&&mColorRectangles[8]
= new Rect(topHeight, mColorRectangles[7].bottom, mRectFrame.right,
mRectFrame.bottom);
(int i = 0; i & 2; i++)
middleLeft = mRectFrame.right * (4 - i) / 12;
middleRight = mRectFrame.right * (5 - i) / 12;
&&&&&mColorRectangles[i
+ 9] = new Rect(middleLeft, 0, middleRight, wideColumnWidth);
&&&&&mColorRectangles[i
+ 11] = new Rect(middleLeft, wideColumnWidth, middleRight,
narrowColumnWidth + wideColumnWidth);
&&&&&mColorRectangles[i
+ 13] = new Rect(middleLeft, narrowColumnWidth * 7 +
wideColumnWidth, middleRight, mRectFrame.bottom);
&&&&mColorRectangles[15]
= new Rect(mRectFrame.right * 4 / 12, narrowColumnWidth +
wideColumnWidth, mRectFrame.right * 5 / 12, narrowColumnWidth * 7 +
wideColumnWidth);
&&&&mGradientRect
= new Rect(mRectFrame.right * 3 / 12, mColorRectangles[15].top,
mColorRectangles[15].left, mColorRectangles[15].bottom);
&&&&mGradient
= new GradientDrawable(Orientation.TOP_BOTTOM, new int[] {
0xffxfffdfdfd });
&&&&mGradient.setBounds(mGradientRect);
&&&&mColorRectangles[16]
= new Rect(0, 0, bottomHeight, wideColumnWidth);
&&&&mColorRectangles[17]
= new Rect(0, mColorRectangles[16].bottom, bottomHeight,
mRectFrame.bottom * 9 / 56 + mColorRectangles[16].bottom);
&&&&mColorRectangles[18]
= new Rect(0, mColorRectangles[17].bottom, bottomHeight,
mRectFrame.bottom * 3 / 14 + mColorRectangles[17].bottom);
&&&&mColorRectangles[19]
= new Rect(0, mColorRectangles[18].bottom, bottomHeight,
mRectFrame.bottom * 45 / 448 + mColorRectangles[18].bottom);
(int i = 20; i & 25; i++)
&&&&&mColorRectangles[i]
= new Rect(0, mColorRectangles[i - 1].bottom, bottomHeight,
mRectFrame.bottom * 15 / 448 + mColorRectangles[i -
1].bottom);
&&&&mColorRectangles[25]
= new Rect(0, mColorRectangles[24].bottom, bottomHeight,
narrowColumnWidth + mColorRectangles[24].bottom);
&&&&mColorRectangles[26]
= new Rect(0, mColorRectangles[25].bottom, bottomHeight,
mRectFrame.bottom);
&&private void CreateBars()
&&&if(mHorizontal)
narrowColumnWidth = mRectFrame.right / 7;
wideColumnWidth = mRectFrame.right * 5 / 28;
narrowestColumnWidth = mRectFrame.right / 21;
topColumnHeight = mRectFrame.bottom *2/3;
middleColumnHeight = mRectFrame.bottom /12;
&&&&mColorRectangles[0]
= new Rect(0, 0, narrowColumnWidth,
topColumnHeight);&&
(int i = 1; i & 7; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[i - 1].right, 0, mColorRectangles[i -
1].right + narrowColumnWidth,
topColumnHeight);&&
&&&&mColorRectangles[7]
= new Rect(0, mColorRectangles[0].bottom, narrowColumnWidth,
mColorRectangles[0].bottom +
middleColumnHeight);&&
(int i = 8; i & 14; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[i - 1].right, mColorRectangles[7].top,
mColorRectangles[i - 1].right + narrowColumnWidth,
mColorRectangles[7].bottom);&&
&&&&mColorRectangles[14]
= new Rect(0, mColorRectangles[7].bottom, wideColumnWidth,
mRectFrame.bottom);&&
(int i = 15; i & 18; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[i - 1].right, mColorRectangles[14].top,
mColorRectangles[i - 1].right + wideColumnWidth,
mRectFrame.bottom);&&
&&&&mColorRectangles[18]
= new Rect(mColorRectangles[17].right, mColorRectangles[17].top,
mColorRectangles[17].right + narrowestColumnWidth,
mRectFrame.bottom);&&
(int i = 19; i & 21; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[i - 1].right, mColorRectangles[14].top,
mColorRectangles[i - 1].right + narrowestColumnWidth,
mRectFrame.bottom);&&
&&&&mColorRectangles[21]
= new Rect(mColorRectangles[20].right, mColorRectangles[17].top,
mColorRectangles[6].right,
mRectFrame.bottom);&&
narrowColumnWidth = mRectFrame.bottom / 7;
wideColumnWidth = mRectFrame.bottom * 5 / 28;
narrowestColumnWidth = mRectFrame.bottom / 21;
topColumnHeight = mRectFrame.right /3;
middleColumnHeight = mRectFrame.right /12;
&&&&mColorRectangles[0]
= new Rect(topColumnHeight, 0, mRectFrame.right,
narrowColumnWidth);&&
(int i = 1; i & 7; i++)
&&&&&mColorRectangles[i]
= new Rect(topColumnHeight, mColorRectangles[i - 1].bottom,
mRectFrame.right, mColorRectangles[i - 1].bottom +
narrowColumnWidth);&&
&&&&mColorRectangles[7]
= new Rect(mColorRectangles[0].left + middleColumnHeight, 0,
mColorRectangles[0].left,
narrowColumnWidth);&&
(int i = 8; i & 14; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[7].left, mColorRectangles[i -
1].bottom, mColorRectangles[7].right, mColorRectangles[i -
1].bottom +
narrowColumnWidth);&&
&&&&mColorRectangles[14]
= new Rect(0, 0, mColorRectangles[7].right,&
wideColumnWidth);&&
(int i = 15; i & 18; i++)
&&&&&mColorRectangles[i]
= new Rect(0, mColorRectangles[i - 1].bottom,
mColorRectangles[7].right, mColorRectangles[i - 1].bottom +
wideColumnWidth);&&
&&&&mColorRectangles[18]
= new Rect(0, mColorRectangles[17].bottom,
mColorRectangles[7].right, mColorRectangles[17].bottom +
narrowestColumnWidth);&&
(int i = 19; i & 21; i++)
&&&&&mColorRectangles[i]
= new Rect(0, mColorRectangles[i - 1].bottom,
mColorRectangles[7].right, mColorRectangles[i - 1].bottom +
narrowestColumnWidth);&&
&&&&mColorRectangles[21]
= new Rect(0, mColorRectangles[20].bottom,
mColorRectangles[7].right,
mRectFrame.bottom);&&
&&private void CreateEbu()
&&&if(mHorizontal)
narrowColumnWidth = mRectFrame.right / 8;
&&&&mColorRectangles[0]
= new Rect(0, 0, narrowColumnWidth,
mRectFrame.bottom);&&
(int i = 1; i & 8; i++)
&&&&&mColorRectangles[i]
= new Rect(mColorRectangles[i - 1].right, 0, mColorRectangles[i -
1].right + narrowColumnWidth,
mRectFrame.bottom);&&
narrowColumnWidth = mRectFrame.bottom / 8;
&&&&mColorRectangles[0]
= new Rect(0, 0, mRectFrame.right, narrowColumnWidth);
(int i = 1; i & 8; i++)
&&&&&mColorRectangles[i]
= new Rect(0, mColorRectangles[i - 1].bottom, mRectFrame.right,
narrowColumnWidth + mColorRectangles[i - 1].bottom);
&这里需要注意的是在androidmanifest.xml文件中加入
&service android:name=".LiveWallpaper"
android:label="@string/app_name"&
android:icon="@drawable/icon"&
&intent-filter&
android:name="android.service.wallpaper.WallpaperService"
&&/intent-filter&
&meta-data
android:name="android.service.wallpaper"&android:resource="@xml/livewallpaper"
&/service&
4. & 新建类LiveWallpaperSettings从 PreferenceActivity
继承实现我们的设置界面,代码如下
& public class LiveWallpaperSettings extends
PreferenceActivity
&implements
SharedPreferences.OnSharedPreferenceChangeListener
&@Override
&protected void onCreate(Bundle icicle)
&&super.onCreate(icicle);
&&getPreferenceManager().setSharedPreferencesName(LiveWallpaper.SHARED_PREFS_NAME);
&&addPreferencesFromResource(R.xml.livewallpaper_settings);
&&getPreferenceManager().getSharedPreferences()
&&&&.registerOnSharedPreferenceChangeListener(this);
&@Override
&protected void onResume()
&&super.onResume();
&@Override
&protected void onDestroy()
&&getPreferenceManager().getSharedPreferences()
&&&&.unregisterOnSharedPreferenceChangeListener(this);
&&super.onDestroy();
&public void
onSharedPreferenceChanged(SharedPreferences
sharedPreferences,
同时仍然在androidmanifest.xml中加入 下面的代码。
android:label="@string/livewallpaper_settings"
&&&android:name=".LiveWallpaperSettings"
&&&android:theme="@android:style/Theme.Light.WallpaperSettings"
&&&android:exported="true"
&&&android:icon="@drawable/icon"&
&&&/activity&
5. 由于Android动态壁纸是2.1 API
Level为7才加入的,所以设置好minSDK以及需要设备支持动态壁纸,我们在androidmanifest.xml中加入
&&uses-sdk
android:minSdkVersion="7" /&
&&uses-feature
android:name="android.software.live_wallpaper"
对于文中ListPreference用到的数组,及代码中涉及的颜色数组,我们在/res/values/
文件夹中创建一个名为testpatterns.xml 的文件,内容为
& &?xml version="1.0"
encoding="utf-8"?&
&resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"&
&&string-array
name="livewallpaper_testpattern_names"&
&&&item&"Color
Bars 16x9"&/item&
&&&item&"Color
Bars 4x3"&/item&
&&&item&"EBU
Color Bars"&/item&
&&/string-array&
&&string-array
name="livewallpaper_testpattern_prefix"&
&&&item&"smpte"&/item&
&&&item&"bars"&/item&
&&&item&"ebu"&/item&
&&/string-array&
&&integer-array
name="smptecolors"&
&&&item&0xFF696969&/item&
&&&item&0xFFC1C1C1&/item&
&&&item&0xFFC1C100&/item&
&&&item&0xFF00C1C1&/item&
&&&item&0xFF00C100&/item&
&&&item&0xFFC100C1&/item&
&&&item&0xFFC10000&/item&
&&&item&0xFF0000C1&/item&
&&&item&0xFF696969&/item&
&&&item&0xFF00FFFF&/item&
&&&item&0xFFFFFF00&/item&
&&&item&0xFF052550&/item&
&&&item&0xFF36056D&/item&
&&&item&0xFF0000FF&/item&
&&&item&0xFFFF0000&/item&
&&&item&0xFFC1C1C1&/item&
&&&item&0xFF2B2B2B&/item&
&&&item&0xFF050505&/item&
&&&item&0xFFFFFFFF&/item&
&&&item&0xFF050505&/item&
&&&item&0xFF000000&/item&
&&&item&0xFF050505&/item&
&&&item&0xFF0A0A0A&/item&
&&&item&0xFF050505&/item&
&&&item&0xFF0D0D0D&/item&
&&&item&0xFF050505&/item&
&&&item&0xFF2b2b2b&/item&
&&/integer-array&
&&integer-array
name="barscolors"&
&&&item&0xFFC0C0C0&/item&
&&&item&0xFFC0C000&/item&
&&&item&0xFF00C0C0&/item&
&&&item&0xFF00C000&/item&
&&&item&0xFFC000C0&/item&
&&&item&0xFFC00000&/item&
&&&item&0xFF0000C0&/item&
&&&item&0xFF0000C0&/item&
&&&item&0xFF131313&/item&
&&&item&0xFFC000C0&/item&
&&&item&0xFF131313&/item&
&&&item&0xFF00C0C0&/item&
&&&item&0xFF131313&/item&
&&&item&0xFFC0C0C0&/item&
&&&item&0xFF00214C&/item&
&&&item&0xFFFFFFFF&/item&
&&&item&0xFF32006A&/item&
&&&item&0xFF131313&/item&
&&&item&0xFF090909&/item&
&&&item&0xFF131313&/item&
&&&item&0xFF1D1D1D&/item&
&&&item&0xFF131313&/item&
&&/integer-array&
&&integer-array
name="ebucolors"&
&&&item&0xFFBFBFBF&/item&
&&&item&0xFFBFBF00&/item&
&&&item&0xFF00BFBF&/item&
&&&item&0xFF00BF00&/item&
&&&item&0xFFBF00BF&/item&
&&&item&0xFFBF0000&/item&
&&&item&0xFF0000BF&/item&
&&&item&0xFF000000&/item&
&&/integer-array&
&/resources&
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 android 3d桌面 的文章

 

随机推荐