Android操作系统中默认的loading动画怎么调用

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android操作系统中默认的loading动画怎么调用相关的知识,希望对你有一定的参考价值。

参考技术A progressdialog先添加要加载xml面
始隐藏其组件
显示progressdialog
延迟段间再显示其组件隐藏progressdialog
// 图片数量
private int count =8;
//图片ID数组
private int[] ids=R.drawable.r1,R.drawable.r2,R.drawable.r3,R.drawable.r4,
R.drawable.r5,R.drawable.r6,R.drawable.r7,R.drawable.r8;

private Handler handler;
private ImageView img_loading;
public void onCreate(Bundle savedInstanceState)

super.onCreate(savedInstanceState);
setContentView(R.layout.loading);
img_loading = (ImageView) this.findViewById(R.id.img_loading);
handler = new Handler()
public void handleMessage(Message msg)

/**
* 更改ImageView图片
*/
img_loading.setImageDrawable(getDrawable(msg.what));

;
play();



/**
* 获取图片象
* @param id
* @return
*/
private Drawable getDrawable(int id)

return this.getResources().getDrawable(ids[id]);


/**
* 播放画
*/
private void play()


new Thread()

@SuppressWarnings("static-access")
@Override
public void run()


while(true)

for (int i = 0; i < count; i++)

handler.sendEmptyMessage(i);
try

this.sleep(100);
catch (InterruptedException e)

e.printStackTrace();




.start();
本回答被提问者和网友采纳
参考技术B android中Dialog的示例代码如下:
1.创建对象框
AlertDialog.Builder builder = new Builder(context);
builder.setTitle("请输入"); //设置对话框标题
builder.setIcon(android.R.drawable.btn_star); //设置对话框标题前的图标

2.创建EditText输入框
final EditText edit = new EditText(context);

3.将输入框赋值给Dialog,并增加确定取消按键
builder.setView(edit);
builder.setPositiveButton("确认", new DialogInterface.OnClickListener()
@Override
public void onClick(DialogInterface dialog, int which)
Toast.makeText(context, "你输入的是: " + edit.getText().toString(), Toast.LENGTH_SHORT).show();

);
builder.setNegativeButton("取消", new DialogInterface.OnClickListener()
@Override
public void onClick(DialogInterface dialog, int which)
Toast.makeText(context, "你点了取消", Toast.LENGTH_SHORT).show();

);

4.设置常用api,并show弹出
builder.setCancelable(true); //设置按钮是否可以按返回键取消,false则不可以取消
AlertDialog dialog = builder.create(); //创建对话框
dialog.setCanceledOnTouchOutside(true); //设置弹出框失去焦点是否隐藏,即点击屏蔽其它地方是否隐藏
dialog.show();

MTK修改开机动画和墙纸要怎修改? 是在res.setting.c的populateDisplaychar中修改那个路径? 如下程序:

#ifdef __MMI_NOKIA_STYLE__
ADD_APPLICATION_IMAGE2(IMG_ID_DISPCHAR_THEME_WALLPAPER, CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\Wallpaper\\\\NOKIA\\\\Wall05."__MMI_RES_TYPE_WALLPAPER__, "wallpaper download");
#elseADD_APPLICATION_IMAGE2(IMG_ID_DISPCHAR_THEME_WALLPAPER, CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\Wallpaper\\\\Wall05."__MMI_RES_TYPE_WALLPAPER__, "wallpaper download");
#endif
#else
ADD_APPLICATION_IMAGE2(IMG_ID_DISPCHAR_THEME_WALLPAPER, CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\Wallpaper\\\\Wall05.gif", "wallpaper download");
#endif

#ifdef __MMI_RES_TYPE_SCREEN_SAVER__
#ifdef __MMI_NOKIA_STYLE__
ADD_APPLICATION_IMAGE2(IMG_ID_DISPCHAR_THEME_SCREENSAVER, CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\Wallpaper\\\\Wall05."__MMI_RES_TYPE_SCREEN_SAVER__, "wallpaper download");
#else
ADD_APPLICATION_IMAGE2(IMG_ID_DISPCHAR_THEME_SCREENSAVER, CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\Wallpaper\\\\Wall05."__MMI_RES_TYPE_SCREEN_SAVER__, "wallpaper download");
#endif
#elif defined __MMI_RES_TYPE_WALLPAPER__
ADD_APPLICATION_IMAGE2(IMG_ID_DISPCHAR_THEME_SCREENSAVER, CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\Wallpaper\\\\Wall05."__MMI_RES_TYPE_WALLPAPER__, "wallpaper download");
#else
ADD_APPLICATION_IMAGE2(IMG_ID_DISPCHAR_THEME_SCREENSAVER, CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\Wallpaper\\\\Wall05.gif", "wallpaper download");
#endif
#endif /* __MMI_THEMES_V2_SUPPORT__ */

ADD_APPLICATION_IMAGE2(IMG_WALLPAPER_SYSTEM, CUST_IMG_BASE_PATH "\\\\NoImage.bmp", "IMG_WALLPAPER_SYSTEM");
ADD_APPLICATION_IMAGE2(IMG_WALLPAPER_DOWNLAOD, CUST_IMG_BASE_PATH "\\\\NoImage.bmp", "IMG_WALLPAPER_DOWNLAOD");
ADD_APPLICATION_IMAGE2(IMG_WALLPAPER_CAPTION, CUST_IMG_BASE_PATH "\\\\NoImage.bmp", "IMG_WALLPAPER_CAPTION");
ADD_APPLICATION_STRING2(STR_WALLPAPER_SELECT_CAPTION, "Wallpaper Select", "STR_WALLPAPER_SET");
ADD_APPLICATION_STRING2(
STR_IDLE_WP_DECODE_ERR,
"Image error, Restore Default Wallpaper",
"User defined wallpaper error message");
……
//Denny mod for wallpaper
#ifdef __MMI_NOKIA_STYLE__
#ifdef __MP539_HARDWARE_V1__
char gif_path[] = CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\WallPaper\\\\NOKIA\\\\Wall05."__MMI_RES_TYPE_WALLPAPER__;
#else
char gif_path[] = CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\WallPaper\\\\NOKIA\\\\Wall05.gif";
#endif
#else
char gif_path[] = CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\WallPaper\\\\Wall05."__MMI_RES_TYPE_WALLPAPER__;
#endif
#else
char gif_path[] = CUST_IMG_PATH "\\\\MainLCD\\\\IdleScreen\\\\WallPaper\\\\Wall05.gif";
#endif
char m3d_path[] = CUST_IMG_PATH "\\\\MainLCD\\\\Active\\\\M3D\\\\m3d01.m3d";

char *path = NULL;
int position = 0;
是不是修改路径(Wall05)就行了?还是还要修改其他的的程序?新手向大家求教了!还有修改开机动画的图片不会工怎么回事?
__MMI_RES_TYPE_POWER_ONOFF__ "JPG"
[D] __MMI_RES_TYPE_SCREEN_SAVER_SEL__ ( (2) )
[D] __MMI_RES_TYPE_SCREEN_SAVER__ "JPG"
[D] __MMI_RES_TYPE_SUBLCD_WALLPAPER__ "GIF"
[D] __MMI_RES_TYPE_WALLPAPER_SEL__ ( (2) )
[D] __MMI_RES_TYPE_WALLPAPER__ "JPG"

参考技术A 开关机直接改:
poweronoff 文件夹(MainLCD\ active\目录下面),
注意要看你定义的 MainLCD size ,然后替换图片即可,替换图片size要一致。

壁纸: \MainLCD\Active\Poweronoff #define CFG_MMI_WALLPAPER_NUM
定义 wallpaper (壁纸)的类型: #define CFG_MMI_RES_TYPE_WALLPAPER_SEL (__RES_TYPE_JPG__)本回答被提问者采纳
参考技术B 在系统设置,待机显示

以上是关于Android操作系统中默认的loading动画怎么调用的主要内容,如果未能解决你的问题,请参考以下文章

Android自定义View实战之仿百度加载动画,一种优雅的Loading方式

开源分享三(炫酷的Android Loading动画)

Android技术分享|自定义View实现Material Design的Loading效果

Android技术分享|自定义View实现Material Design的Loading效果

关于 flutter_boost splash加载动画

在Android上仿百度贴吧客户端Loading图标小球