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

相关文章

MySQL索引的优化之LIKE模糊查询功能实现

《MySQL索引的优化之LIKE模糊查询功能实现》:本文主要介绍MySQL索引的优化之LIKE模糊查询功能实现,本文通过示例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录一、前缀匹配优化二、后缀匹配优化三、中间匹配优化四、覆盖索引优化五、减少查询范围六、避免通配符开头七、使用外部搜索引擎八、分

Python实现特殊字符判断并去掉非字母和数字的特殊字符

《Python实现特殊字符判断并去掉非字母和数字的特殊字符》在Python中,可以通过多种方法来判断字符串中是否包含非字母、数字的特殊字符,并将这些特殊字符去掉,本文为大家整理了一些常用的,希望对大家... 目录1. 使用正则表达式判断字符串中是否包含特殊字符去掉字符串中的特殊字符2. 使用 str.isa

Spring Boot 集成 Quartz并使用Cron 表达式实现定时任务

《SpringBoot集成Quartz并使用Cron表达式实现定时任务》本篇文章介绍了如何在SpringBoot中集成Quartz进行定时任务调度,并通过Cron表达式控制任务... 目录前言1. 添加 Quartz 依赖2. 创建 Quartz 任务3. 配置 Quartz 任务调度4. 启动 Sprin

MySql match against工具详细用法

《MySqlmatchagainst工具详细用法》在MySQL中,MATCH……AGAINST是全文索引(Full-Textindex)的查询语法,它允许你对文本进行高效的全文搜素,支持自然语言搜... 目录一、全文索引的基本概念二、创建全文索引三、自然语言搜索四、布尔搜索五、相关性排序六、全文索引的限制七

Android实现悬浮按钮功能

《Android实现悬浮按钮功能》在很多场景中,我们希望在应用或系统任意界面上都能看到一个小的“悬浮按钮”(FloatingButton),用来快速启动工具、展示未读信息或快捷操作,所以本文给大家介绍... 目录一、项目概述二、相关技术知识三、实现思路四、整合代码4.1 Java 代码(MainActivi

使用Python实现一个优雅的异步定时器

《使用Python实现一个优雅的异步定时器》在Python中实现定时器功能是一个常见需求,尤其是在需要周期性执行任务的场景下,本文给大家介绍了基于asyncio和threading模块,可扩展的异步定... 目录需求背景代码1. 单例事件循环的实现2. 事件循环的运行与关闭3. 定时器核心逻辑4. 启动与停

基于Python实现读取嵌套压缩包下文件的方法

《基于Python实现读取嵌套压缩包下文件的方法》工作中遇到的问题,需要用Python实现嵌套压缩包下文件读取,本文给大家介绍了详细的解决方法,并有相关的代码示例供大家参考,需要的朋友可以参考下... 目录思路完整代码代码优化思路打开外层zip压缩包并遍历文件:使用with zipfile.ZipFil

Python实现word文档内容智能提取以及合成

《Python实现word文档内容智能提取以及合成》这篇文章主要为大家详细介绍了如何使用Python实现从10个左右的docx文档中抽取内容,再调整语言风格后生成新的文档,感兴趣的小伙伴可以了解一下... 目录核心思路技术路径实现步骤阶段一:准备工作阶段二:内容提取 (python 脚本)阶段三:语言风格调

C#实现将Excel表格转换为图片(JPG/ PNG)

《C#实现将Excel表格转换为图片(JPG/PNG)》Excel表格可能会因为不同设备或字体缺失等问题,导致格式错乱或数据显示异常,转换为图片后,能确保数据的排版等保持一致,下面我们看看如何使用C... 目录通过C# 转换Excel工作表到图片通过C# 转换指定单元格区域到图片知识扩展C# 将 Excel

Android Mainline基础简介

《AndroidMainline基础简介》AndroidMainline是通过模块化更新Android核心组件的框架,可能提高安全性,本文给大家介绍AndroidMainline基础简介,感兴趣的朋... 目录关键要点什么是 android Mainline?Android Mainline 的工作原理关键