android中dialog工具类的实现(多种dialog的创建)

2024-06-23 08:18

本文主要是介绍android中dialog工具类的实现(多种dialog的创建),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

第一种:bitmapDialog的建立

javademo1:

package com.demo.dialog;import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;/*** Create custom Dialog windows for your application Custom dialogs rely on* custom layouts wich allow you to create and use your own look & feel.**/
public class BitmapDialog extends Dialog {public BitmapDialog(Context context, int theme) {super(context, theme);}public BitmapDialog(Context context) {super(context);}/*** Helper class for creating a custom dialog*/public static class Builder {@SuppressWarnings("unused")private ViewTreeObserver viewTreeObserver;private Context context;private View contentView;private ImageView img;private Bitmap bitmap;public Builder(Context context) {this.context = context;}public Builder setBitmap(Bitmap bit) {this.bitmap = bit;return this;}public Builder setContentView(View v) {this.contentView = v;return this;}/*** * Create the custom dialog*/public BitmapDialog create() {LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);// instantiate the dialog with the custom Themefinal BitmapDialog dialog = new BitmapDialog(context,R.style.Dialog);View layout = inflater.inflate(R.layout.bitmap_dialog_layout, null);dialog.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));if (bitmap != null) {img = (ImageView) layout.findViewById(R.id.bitmap_dialog_imageview);img.setImageBitmap(bitmap);}if (contentView != null) {// if no message set// add the contentView to the dialog body((LinearLayout) layout.findViewById(R.id.content)).removeAllViews();((LinearLayout) layout.findViewById(R.id.content)).addView(contentView,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));}dialog.setContentView(layout);return dialog;}}}
javaDemo2
package com.demo.dialog;import android.content.Context;
import android.graphics.Bitmap;/*自定义Dialog方法*/
public class BitmapHelper {public static BitmapDialog createDialog(Context context, Bitmap bitmap) {BitmapDialog.Builder dialogBuilder = new BitmapDialog.Builder(context);dialogBuilder.setBitmap(bitmap);return dialogBuilder.create();}
}

第二种:customDialog的建立:

javademo1:

package com.demo.dialog;import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;/*** Create custom Dialog windows for your application Custom dialogs rely on* custom layouts wich allow you to create and use your own look & feel.**/
public class CustomDialog extends Dialog {public CustomDialog(Context context, int theme) {super(context, theme);}public CustomDialog(Context context) {super(context);}/*** Helper class for creating a custom dialog*/public static class Builder {private Context context;private String message;private String positiveButtonText;private String negativeButtonText;private View contentView;private boolean isWaitDialog;private DialogInterface.OnClickListenerpositiveButtonClickListener,negativeButtonClickListener;public Builder(Context context) {this.context = context;}/*** * Set the Dialog message from String* * @param title* * @return*/public Builder setMessage(String message) {this.message = message;return this;}public Builder setWiatDialog(boolean isWaitDialog) {this.isWaitDialog = isWaitDialog;return this;}/*** * Set the Dialog message from resource* * @param title* * @return*/public Builder setMessage(int message) {this.message = (String) context.getText(message);return this;}/*** * Set a custom content view for the Dialog.* * If a message is set, the contentView is not* * added to the Dialog...* * @param v* * @return*/public Builder setContentView(View v) {this.contentView = v;return this;}/*** * Set the positive button resource and it's listener* * @param positiveButtonText* * @param listener* * @return*/public Builder setPositiveButton(int positiveButtonText,DialogInterface.OnClickListener listener) {this.positiveButtonText = (String) context.getText(positiveButtonText);this.positiveButtonClickListener = listener;return this;}/*** * Set the positive button text and it's listener* * @param positiveButtonText* * @param listener* * @return*/public Builder setPositiveButton(String positiveButtonText,DialogInterface.OnClickListener listener) {this.positiveButtonText = positiveButtonText;this.positiveButtonClickListener = listener;return this;}/*** * Set the negative button resource and it's listener* * @param negativeButtonText* * @param listener* * @return*/public Builder setNegativeButton(int negativeButtonText,DialogInterface.OnClickListener listener) {this.negativeButtonText = (String) context.getText(negativeButtonText);this.negativeButtonClickListener = listener;return this;}/*** * Set the negative button text and it's listener* * @param negativeButtonText* * @param listener* * @return*/public Builder setNegativeButton(String negativeButtonText,DialogInterface.OnClickListener listener) {this.negativeButtonText = negativeButtonText;this.negativeButtonClickListener = listener;return this;}/*** * Create the custom dialog*/public CustomDialog create() {LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);// instantiate the dialog with the custom Themefinal CustomDialog dialog = new CustomDialog(context,R.style.Dialog);View layout = inflater.inflate(R.layout.custom_dialog_layout, null);dialog.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));// set the confirm buttonif (positiveButtonText != null) {((Button) layout.findViewById(R.id.positiveButton)).setText(positiveButtonText);if (positiveButtonClickListener != null) {((Button) layout.findViewById(R.id.positiveButton)).setOnClickListener(new View.OnClickListener() {public void onClick(View v) {positiveButtonClickListener.onClick(dialog,DialogInterface.BUTTON_POSITIVE);}});}} else {// if no confirm button just set the visibility to GONElayout.findViewById(R.id.positiveButton).setVisibility(View.GONE);}if (isWaitDialog) {layout.findViewById(R.id.progressBar1).setVisibility(View.VISIBLE);} else {layout.findViewById(R.id.progressBar1).setVisibility(View.GONE);}// set the cancel buttonif (negativeButtonText != null) {((Button) layout.findViewById(R.id.negativeButton)).setText(negativeButtonText);if (negativeButtonClickListener != null) {((Button) layout.findViewById(R.id.negativeButton)).setOnClickListener(new View.OnClickListener() {public void onClick(View v) {negativeButtonClickListener.onClick(dialog,DialogInterface.BUTTON_NEGATIVE);}});}} else {// if no confirm button just set the visibility to GONElayout.findViewById(R.id.negativeButton).setVisibility(View.GONE);}// set the content messageif (message != null) {((TextView) layout.findViewById(R.id.message)).setText(message);} else if (contentView != null) {// if no message set// add the contentView to the dialog body((LinearLayout) layout.findViewById(R.id.content)).removeAllViews();((LinearLayout) layout.findViewById(R.id.content)).addView(contentView,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));}dialog.setContentView(layout);return dialog;}}}

javaDemo2:

package com.demo.dialog;import android.content.Context;
import android.content.DialogInterface;/*customdialog*/
public class CustomDialogHelper {public static CustomDialog createDialog(Context context, String msg) {CustomDialog.Builder dialogBuilder = new CustomDialog.Builder(context);dialogBuilder.setWiatDialog(false);dialogBuilder.setMessage(msg);return dialogBuilder.create();}public static CustomDialog createDialogWait(Context context, String msg) {CustomDialog.Builder dialogBuilder = new CustomDialog.Builder(context);dialogBuilder.setWiatDialog(true);dialogBuilder.setMessage(msg);return dialogBuilder.create();}public static CustomDialog createDialog(Context context, String title,String msg, String btnName) {CustomDialog.Builder dialogBuilder = new CustomDialog.Builder(context);dialogBuilder.setWiatDialog(false);dialogBuilder.setMessage(msg);dialogBuilder.setNegativeButton(btnName,new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {dialog.dismiss();}});return dialogBuilder.create();}public static CustomDialog createProgressDialog(Context context,String title, String msg) {CustomDialog.Builder dialogBuilder = new CustomDialog.Builder(context);dialogBuilder.setWiatDialog(true);dialogBuilder.setMessage(msg);return dialogBuilder.create();}public static CustomDialog createDialog1(Context context, String msg,String btnName) {CustomDialog.Builder dialogBuilder = new CustomDialog.Builder(context);dialogBuilder.setWiatDialog(false);dialogBuilder.setMessage(msg);dialogBuilder.setNegativeButton(btnName,new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {dialog.dismiss();}});return dialogBuilder.create();}
}
第三种:

Logdialog的建立:javaDemo1

package com.demo.dialog;import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;/*** Create custom Dialog windows for your application Custom dialogs rely on* custom layouts wich allow you to create and use your own look & feel.**/
public class LogDialog extends Dialog {public LogDialog(Context context, int theme) {super(context, theme);}public LogDialog(Context context) {super(context);}/*** Helper class for creating a custom dialog*/public static class Builder {private Context context;private String message;private View contentView;public Builder(Context context) {this.context = context;}/*** * Set the Dialog message from String* * @param title* * @return*/public Builder setMessage(String message) {this.message = message;return this;}/*** * Set the Dialog message from resource* * @param title* * @return*/public Builder setMessage(int message) {this.message = (String) context.getText(message);return this;}/*** * Set a custom content view for the Dialog.* * If a message is set, the contentView is not* * added to the Dialog...* * @param v* * @return*/public Builder setContentView(View v) {this.contentView = v;return this;}/*** * Create the custom dialog*/public LogDialog create() {LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);// instantiate the dialog with the custom Themefinal LogDialog dialog = new LogDialog(context,R.style.Dialog);View layout = inflater.inflate(R.layout.log_dialog_layout, null);dialog.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));// set the content messageif (message != null) {((TextView) layout.findViewById(R.id.log_dialog_message)).setText(message);} else if (contentView != null) {// if no message set// add the contentView to the dialog body((LinearLayout) layout.findViewById(R.id.content)).removeAllViews();((LinearLayout) layout.findViewById(R.id.content)).addView(contentView,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));}dialog.setContentView(layout);return dialog;}}}

javademo2:

package com.demo.dialog;import android.content.Context;public class LogDialogHelper {public static LogDialog createDialog(Context context, String msg) {LogDialog.Builder dialogBuilder = new LogDialog.Builder(context);dialogBuilder.setMessage(msg);return dialogBuilder.create();}}


第四种:

progressDialog的建立:(很多类是自定义的,还没修改)

Javademo1:


import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;/*** Create custom Dialog windows for your application Custom dialogs rely on* custom layouts wich allow you to create and use your own look & feel.**/
public class ProgressDialog extends Dialog {public ProgressDialog(Context context, int theme) {super(context, theme);}public ProgressDialog(Context context) {super(context);}/*** Helper class for creating a custom dialog*/public static class Builder {private final int REQUESTFAIL = 0;private final int MEMBERCARDTHREAD = 20;private final int BILLTHREAD = 40;private final int ORDERBASETHREAD = 60;private final int INVOICETHREAD = 80;private final int UPLOADFINISH = 100;private Context context;private String message;private View contentView;private ProgressBar bar;private Animation animation;public Builder(Context context) {this.context = context;}public ProgressBar getBar() {return bar;}/*** * Set the Dialog message from String* * @param title* * @return*/public Builder setMessage(String message) {this.message = message;return this;}/*** * Set the Dialog message from resource* * @param title* * @return*/public Builder setMessage(int message) {this.message = (String) context.getText(message);return this;}/*** * Set a custom content view for the Dialog.* * If a message is set, the contentView is not* * added to the Dialog...* * @param v* * @return*/public Builder setContentView(View v) {this.contentView = v;return this;}public ProgressDialog create() {LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);final ProgressDialog dialog = new ProgressDialog(context,R.style.Dialog);dialog.setCanceledOnTouchOutside(false);View layout = inflater.inflate(R.layout.progressdialog, null);dialog.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));dialog.setOnDismissListener(new OnDismissListener() {@Overridepublic void onDismiss(DialogInterface dialog) {FrameMainActivity.proBool = true;}});Handler handler = new Handler() {@Overridepublic void handleMessage(Message msg) {switch (msg.what) {case MEMBERCARDTHREAD:if (bar == null)FrameMainActivity.proBool = true;bar.incrementProgressBy(20);break;case BILLTHREAD:bar.incrementProgressBy(20);break;case ORDERBASETHREAD:bar.incrementProgressBy(10);break;case INVOICETHREAD:bar.incrementProgressBy(30);break;case UPLOADFINISH:bar.incrementProgressBy(20);if (dialog.isShowing())dialog.dismiss();FrameMainActivity.proBool = true;break;case REQUESTFAIL:if (dialog.isShowing()) {Toast.makeText(context, "数据更新失败,请检查网络!",Toast.LENGTH_SHORT).show();dialog.dismiss();}FrameMainActivity.proBool = true;break;}super.handleMessage(msg);}};if (message != null) {((TextView) layout.findViewById(R.id.progressdialog_txt)).setText(message);animation = AnimationUtils.loadAnimation(context,R.anim.progress_alpha);bar = ((ProgressBar) layout.findViewById(R.id.progressdialog_pro));bar.setAnimation(animation);dataThread(handler);}if (contentView != null) {((LinearLayout) layout.findViewById(R.id.content)).removeAllViews();((LinearLayout) layout.findViewById(R.id.content)).addView(contentView,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));}dialog.setContentView(layout);return dialog;}}public static void dataThread(final Handler handler) {Runnable runnable = new Runnable() {@Overridepublic void run() {Log.d("info", "dataThread启动");Datasync datasync = null;SharepreferenceData sharepreferenceData = SharepreferenceData.getInstance(GabelApplication.getInstance());int i = 0;while (!FrameMainActivity.proBool) {try {Thread.sleep(1000);i++;if (i == 15) {handler.sendEmptyMessage(0);break;}} catch (InterruptedException e) {e.printStackTrace();}if (!sharepreferenceData.getServiceStat()) {continue;}if (!FrameMainActivity.proBool) {datasync = new MemberCardImpl();datasync.handlerData();handler.sendEmptyMessage(20);}if (!FrameMainActivity.proBool) {datasync = new BillPayImpl();datasync.handlerData();handler.sendEmptyMessage(40);}if (!FrameMainActivity.proBool) {datasync = new OrderBasicInfoImpl();datasync.handlerData();handler.sendEmptyMessage(80);}if (!FrameMainActivity.proBool) {datasync = new BillInvoiceLogImpl();datasync.handlerData();handler.sendEmptyMessage(100);}break;}};};new Thread(runnable).start();}
}
javaDemo2:

package com.demo.dialog;import android.content.Context;public class ProgressDialogHelper {public static ProgressDialog createDialog(Context context, String msg) {ProgressDialog.Builder dialogBuilder = new ProgressDialog.Builder(context);// dialogBuilder.setHandler(handler);dialogBuilder.setMessage(msg);return dialogBuilder.create();}}


第五种:URLDialog的建立:

Javademo1:

package com.demo.dialog;import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;/*** Create custom Dialog windows for your application Custom dialogs rely on* custom layouts wich allow you to create and use your own look & feel.**/
public class SetURLDialog extends Dialog {public SetURLDialog(Context context, int theme) {super(context, theme);}public SetURLDialog(Context context) {super(context);}/*** Helper class for creating a custom dialog*/public static class Builder {private EditText editText;private Context context;private String message;private String positiveButtonText;private String negativeButtonText;private View contentView;private DialogInterface.OnClickListenerpositiveButtonClickListener,negativeButtonClickListener;public Builder(Context context) {this.context = context;}public Builder setMessage(String message) {this.message = message;return this;}public Builder setMessage(int message) {this.message = (String) context.getText(message);return this;}public Builder setContentView(View v) {this.contentView = v;return this;}public Builder setPositiveButton(int positiveButtonText,DialogInterface.OnClickListener listener) {this.positiveButtonText = (String) context.getText(positiveButtonText);this.positiveButtonClickListener = listener;return this;}public Builder setPositiveButton(String positiveButtonText,DialogInterface.OnClickListener listener) {this.positiveButtonText = positiveButtonText;this.positiveButtonClickListener = listener;return this;}public Builder setNegativeButton(int negativeButtonText,DialogInterface.OnClickListener listener) {this.negativeButtonText = (String) context.getText(negativeButtonText);this.negativeButtonClickListener = listener;return this;}public Builder setNegativeButton(String negativeButtonText,DialogInterface.OnClickListener listener) {this.negativeButtonText = negativeButtonText;this.negativeButtonClickListener = listener;return this;}public String getEditText() {return editText.getText() + "";}/*** * Create the custom dialog*/public SetURLDialog create() {LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);// instantiate the dialog with the custom Themefinal SetURLDialog dialog = new SetURLDialog(context,R.style.Dialog);View layout = inflater.inflate(R.layout.set_serviceurl_dialog_layout, null);dialog.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));// set the confirm buttonif (positiveButtonText != null) {((Button) layout.findViewById(R.id.set_serviceurl_positiveButton)).setText(positiveButtonText);if (positiveButtonClickListener != null) {((Button) layout.findViewById(R.id.set_serviceurl_positiveButton)).setOnClickListener(new View.OnClickListener() {public void onClick(View v) {positiveButtonClickListener.onClick(dialog,DialogInterface.BUTTON_POSITIVE);}});}} else {// if no confirm button just set the visibility to GONElayout.findViewById(R.id.set_serviceurl_positiveButton).setVisibility(View.GONE);}// set the cancel buttonif (negativeButtonText != null) {((Button) layout.findViewById(R.id.set_serviceurl_negativeButton)).setText(negativeButtonText);if (negativeButtonClickListener != null) {((Button) layout.findViewById(R.id.set_serviceurl_negativeButton)).setOnClickListener(new View.OnClickListener() {public void onClick(View v) {negativeButtonClickListener.onClick(dialog,DialogInterface.BUTTON_NEGATIVE);}});}} else {// if no confirm button just set the visibility to GONElayout.findViewById(R.id.set_serviceurl_negativeButton).setVisibility(View.GONE);}// set the content messageif (message != null) {editText = ((EditText) layout.findViewById(R.id.set_serviceurl_edit));editText.setText(message);} else if (contentView != null) {// if no message set// add the contentView to the dialog body((LinearLayout) layout.findViewById(R.id.content)).removeAllViews();((LinearLayout) layout.findViewById(R.id.content)).addView(contentView,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));}dialog.setContentView(layout);return dialog;}}}

javaDemo2:

package com.demo.dialog;import android.content.Context;
import android.content.DialogInterface;
import android.widget.Toast;/*自定义Dialog方法*/
public class SetURLDialogHelper {public static SetURLDialog createDialog(final Context context, String msg) {final SetURLDialog.Builder dialogBuilder = new SetURLDialog.Builder(context);dialogBuilder.setMessage(msg);dialogBuilder.setNegativeButton("取消",new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {Toast.makeText(context, "取消保存", Toast.LENGTH_SHORT).show();dialog.dismiss();}});dialogBuilder.setPositiveButton("确定",new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which) {SharepreferenceData.getInstance(context).setServiceURL(dialogBuilder.getEditText());Toast.makeText(context, "保存成功", Toast.LENGTH_SHORT).show();dialog.dismiss();}});return dialogBuilder.create();}}



这篇关于android中dialog工具类的实现(多种dialog的创建)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1086621

相关文章

hdu1043(八数码问题,广搜 + hash(实现状态压缩) )

利用康拓展开将一个排列映射成一个自然数,然后就变成了普通的广搜题。 #include<iostream>#include<algorithm>#include<string>#include<stack>#include<queue>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#inclu

【C++】_list常用方法解析及模拟实现

相信自己的力量,只要对自己始终保持信心,尽自己最大努力去完成任何事,就算事情最终结果是失败了,努力了也不留遗憾。💓💓💓 目录   ✨说在前面 🍋知识点一:什么是list? •🌰1.list的定义 •🌰2.list的基本特性 •🌰3.常用接口介绍 🍋知识点二:list常用接口 •🌰1.默认成员函数 🔥构造函数(⭐) 🔥析构函数 •🌰2.list对象

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

让树莓派智能语音助手实现定时提醒功能

最初的时候是想直接在rasa 的chatbot上实现,因为rasa本身是带有remindschedule模块的。不过经过一番折腾后,忽然发现,chatbot上实现的定时,语音助手不一定会有响应。因为,我目前语音助手的代码设置了长时间无应答会结束对话,这样一来,chatbot定时提醒的触发就不会被语音助手获悉。那怎么让语音助手也具有定时提醒功能呢? 我最后选择的方法是用threading.Time

高效录音转文字:2024年四大工具精选!

在快节奏的工作生活中,能够快速将录音转换成文字是一项非常实用的能力。特别是在需要记录会议纪要、讲座内容或者是采访素材的时候,一款优秀的在线录音转文字工具能派上大用场。以下推荐几个好用的录音转文字工具! 365在线转文字 直达链接:https://www.pdf365.cn/ 365在线转文字是一款提供在线录音转文字服务的工具,它以其高效、便捷的特点受到用户的青睐。用户无需下载安装任何软件,只

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

Android实现任意版本设置默认的锁屏壁纸和桌面壁纸(两张壁纸可不一致)

客户有些需求需要设置默认壁纸和锁屏壁纸  在默认情况下 这两个壁纸是相同的  如果需要默认的锁屏壁纸和桌面壁纸不一样 需要额外修改 Android13实现 替换默认桌面壁纸: 将图片文件替换frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.*  (注意不能是bmp格式) 替换默认锁屏壁纸: 将图片资源放入vendo

C#实战|大乐透选号器[6]:实现实时显示已选择的红蓝球数量

哈喽,你好啊,我是雷工。 关于大乐透选号器在前面已经记录了5篇笔记,这是第6篇; 接下来实现实时显示当前选中红球数量,蓝球数量; 以下为练习笔记。 01 效果演示 当选择和取消选择红球或蓝球时,在对应的位置显示实时已选择的红球、蓝球的数量; 02 标签名称 分别设置Label标签名称为:lblRedCount、lblBlueCount

Android平台播放RTSP流的几种方案探究(VLC VS ExoPlayer VS SmartPlayer)

技术背景 好多开发者需要遴选Android平台RTSP直播播放器的时候,不知道如何选的好,本文针对常用的方案,做个大概的说明: 1. 使用VLC for Android VLC Media Player(VLC多媒体播放器),最初命名为VideoLAN客户端,是VideoLAN品牌产品,是VideoLAN计划的多媒体播放器。它支持众多音频与视频解码器及文件格式,并支持DVD影音光盘,VCD影

在cscode中通过maven创建java项目

在cscode中创建java项目 可以通过博客完成maven的导入 建立maven项目 使用快捷键 Ctrl + Shift + P 建立一个 Maven 项目 1 Ctrl + Shift + P 打开输入框2 输入 "> java create"3 选择 maven4 选择 No Archetype5 输入 域名6 输入项目名称7 建立一个文件目录存放项目,文件名一般为项目名8 确定