`
夏文权
  • 浏览: 245385 次
  • 性别: Icon_minigender_1
  • 来自: 贵州
社区版块
存档分类
最新评论

android AlphabetListView

 
阅读更多
写道
有源码,在后面可以下载,这个方面的资料比较少,分享出来共同学习。
数据源是取出通讯录中的数据。
 
写道
AlphabetListView的实现:
 
package com.xiawenquan.test.widget;

import java.util.HashMap;

import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.xiawenquan.test.asyncqueryhandler.R;
import com.xiawenquan.test.widget.AlphabetView.OnTouchingLetterChangedListener;

public class AlphabetListView extends RelativeLayout {
	private Context mContext;
	private ListView mListView;
	private AlphabetView mAlphabetView;
	private HashMap<String, Integer> alphaIndexer;
	private TextView overlay;
	private Handler handler;
	private OverlayThread overlayThread;

	public AlphabetListView(Context context) {
		super(context);
		init(context);
	}

	public AlphabetListView(Context context, AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}

	public AlphabetListView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init(context);
	}

	private void init(Context context) {

		mContext = context;
		LayoutInflater.from(context)
				.inflate(R.layout.alphabet_list, this, true);
		mListView = (ListView) findViewById(R.id.list_view);
		mAlphabetView = (AlphabetView) findViewById(R.id.alphabet_view);
		handler = new Handler();
		overlayThread = new OverlayThread();
		initOverlay();

		mAlphabetView
				.setOnTouchingLetterChangedListener(new OnTouchingLetterChangedListener() {

					public void onTouchingLetterChanged(String s) {
						if (alphaIndexer == null) {
							// throw new
							// RuntimeException("setAlphabetIndex方法未赋值");
						} else {
							final Integer position = alphaIndexer.get(s);
							if (position != null) {
								mListView.setSelection(position);
								overlay.setText(s);
								overlay.setVisibility(View.VISIBLE);
								handler.removeCallbacks(overlayThread);
								// 延迟一秒后执行,让overlay为不可见
								handler.postDelayed(overlayThread, 1500);
							} else if ("搜".equals(s)) {
								mListView.setSelection(0);
								overlay.setText(s);
								overlay.setVisibility(View.VISIBLE);
								handler.removeCallbacks(overlayThread);
								// 延迟一秒后执行,让overlay为不可见
								handler.postDelayed(overlayThread, 1500);
							}
						}
					}
				});
	}

	/**
	 * 设置首字母title再ListView中的位置
	 * 
	 * @param alphaIndexer
	 */
	public void setAlphabetIndex(HashMap<String, Integer> alphaIndexer) {
		this.alphaIndexer = alphaIndexer;
	}

	// 初始化汉语拼音首字母弹出提示框
	private void initOverlay() {
		final LayoutInflater inflater = LayoutInflater.from(mContext);
		overlay = (TextView) inflater.inflate(R.layout.overlay, null);
		overlay.setVisibility(View.INVISIBLE);
		final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
				WindowManager.LayoutParams.TYPE_APPLICATION,
				WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
						| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
				PixelFormat.TRANSLUCENT);
		final WindowManager windowManager = (WindowManager) mContext
				.getSystemService(Context.WINDOW_SERVICE);
		windowManager.addView(overlay, lp);
	}

	/**
	 * 设置overlay不可见
	 */
	public class OverlayThread implements Runnable {

		public void run() {
			overlay.setVisibility(View.GONE);
		}
	}

	public void setListViewBackgroundResource(int resid) {
		if (mListView != null) {
			mListView.setBackgroundResource(resid);
		}
	}

	public void setListViewBackgroundDrawable(Drawable d) {
		if (mListView != null) {
			mListView.setBackgroundDrawable(d);
		}
	}

	public void setListViewDivider(Drawable divider) {
		if (mListView != null) {
			mListView.setDivider(divider);
		}
	}

	public void setAdapter(BaseAdapter adapter) {
		if (mListView != null) {
			mListView.setAdapter(adapter);
		}
	}

	public void setListViewsetVisibility(int visibility) {
		if (mListView != null) {
			mListView.setVisibility(visibility);
		}
	}

	/**
	 * 设置字母列表默认颜色
	 * 
	 * @param color
	 */
	public void setDefaultColor(int color) {
		if (mAlphabetView != null) {
			mAlphabetView.setDefaultColor(color);
		}
	}

	/**
	 * 设置字母列表选中颜色
	 * 
	 * @param color
	 */
	public void setSelectColor(int color) {
		if (mAlphabetView != null) {
			mAlphabetView.setSelectColor(color);
		}
	}

	/**
	 * 设置字体大小
	 * 
	 * @param size
	 */
	public void setTextSize(float size) {
		if (mAlphabetView != null) {
			mAlphabetView.setTextSize(size);
		}
	}

	/**
	 * 设置搜索icon
	 * 
	 * @param resid
	 */
	public void setSearchIcon(int resid) {
		if (mAlphabetView != null) {
			mAlphabetView.setSearchIcon(resid);
		}
	}

	/**
	 * 设置搜索icon
	 * 
	 * @param resid
	 */
	public void setSearchIcon(Drawable drawable) {
		if (mAlphabetView != null) {
			mAlphabetView.setSearchIcon(drawable);
		}
	}

	/**
	 * 设置是否显示搜索icon
	 * 
	 * @param isShowSearchIcon
	 */
	public void setShowSearchIcon(boolean isShowSearchIcon) {
		if (mAlphabetView != null) {
			mAlphabetView.setShowSearchIcon(isShowSearchIcon);
		}
	}

	/**
	 * 设置索引浮窗字号
	 * 
	 * @param size
	 */
	public void setOverlayTextSize(float size) {
		if (overlay != null) {
			overlay.setTextSize(size);
		}
	}

	/**
	 * 设置索引浮窗字体颜色
	 * 
	 * @param color
	 */
	public void setOverlayTextColor(int color) {
		if (overlay != null) {
			overlay.setTextColor(color);
		}
	}

	/**
	 * 设置索引浮窗背景
	 * 
	 * @param resId
	 */
	public void setOverlayBackground(int resid) {
		if (overlay != null) {
			overlay.setBackgroundResource(resid);
		}
	}

	public void setOnItemClickListener(final OnItemClickListener listener) {
		if (mListView != null) {
			mListView
					.setOnItemClickListener(new ListView.OnItemClickListener() {

						public void onItemClick(AdapterView<?> arg0, View arg1,
								int arg2, long arg3) {
							if (listener != null) {
								listener.onItemClick(arg0, arg1, arg2, arg3);
							}

						}
					});
		}
	}

	public void setOnItemLongClickListener(
			final OnItemLongClickListener listener) {
		if (mListView != null) {
			mListView
					.setOnItemLongClickListener(new ListView.OnItemLongClickListener() {
						public boolean onItemLongClick(AdapterView<?> arg0,
								View arg1, int arg2, long arg3) {
							if (listener != null) {
								listener.onItemLongClick(arg0, arg1, arg2, arg3);
							}
							return false;
						}
					});
		}
	}

	public interface OnItemClickListener {
		public void onItemClick(AdapterView<?> parent, View view, int position,
				long id);
	}

	public interface OnItemLongClickListener {
		public void onItemLongClick(AdapterView<?> parent, View view,
				int position, long id);
	}

	public void setAlphabetViewVisibility(int visibility) {
		if (mAlphabetView != null) {
			mAlphabetView.setVisibility(visibility);
		}
	}
}

 

 

写道
AlphabetView 的实现:
 

 

package com.xiawenquan.test.widget;

import com.xiawenquan.test.asyncqueryhandler.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

public class AlphabetView extends View {
	private Bitmap bitmap = null;
	private OnTouchingLetterChangedListener onTouchingLetterChangedListener;
	private int choose = -1;
	private Paint paint = new Paint();
	private boolean isShowSearchIcon = true;
	private String[] alphabetList = { "#", "A", "B", "C", "D", "E", "F", "G",
			"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
			"U", "V", "W", "X", "Y", "Z" };
	private int mDefaultColor = Color.parseColor("#6a737d");
	private int mSelectColor = Color.parseColor("#3399ff");
	private float textSize = getResources().getDimension(
			R.dimen.alphabet_text_size);

	public AlphabetView(Context context) {
		super(context);
		init(context);
	}

	public AlphabetView(Context context, AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}

	public AlphabetView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		init(context);
	}

	private void init(Context context) {
		bitmap = BitmapFactory.decodeResource(getResources(),
				R.drawable.alphabet_search_icon);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);

		final int height = getHeight();
		final int width = getWidth();
		int singleHeight = height / alphabetList.length;
		final int size = alphabetList.length;
		for (int i = 0; i < size; i++) {
			if (alphabetList[i].equals("#")) {
				if (isShowSearchIcon) {
					float xPos = width / 2 - bitmap.getWidth() / 2;
					float yPos = bitmap.getHeight() / 2;

					// if(i == choose) {// 设置搜索icon选中效果
					// final Bitmap b =
					// BitmapFactory.decodeResource(getResources(),
					// R.drawable.icon);
					// canvas.drawBitmap(b, xPos, yPos, paint);
					// } else {
					canvas.drawBitmap(bitmap, xPos, yPos, paint);
					// }
					paint.reset();
				}
			} else {
				paint.setColor(mDefaultColor);
				paint.setAntiAlias(true);
				paint.setTextSize(textSize);
				if (i == choose) {
					paint.setColor(mSelectColor);
					paint.setFakeBoldText(true);
				}
				float xPos = width / 2 - paint.measureText(alphabetList[i]) / 2;
				float yPos = singleHeight * i + singleHeight;
				;
				canvas.drawText(alphabetList[i], xPos, yPos, paint);
				paint.reset();
			}
		}

	}

	/**
	 * 设置字母列表默认颜色
	 * 
	 * @param color
	 */
	protected void setDefaultColor(int color) {
		mDefaultColor = color;
	}

	/**
	 * 设置字母列表选中颜色
	 * 
	 * @param color
	 */
	protected void setSelectColor(int color) {
		mSelectColor = color;
	}

	/**
	 * 设置字体大小
	 * 
	 * @param size
	 */
	protected void setTextSize(float size) {
		textSize = size;
	}

	/**
	 * 设置搜索icon
	 * 
	 * @param resid
	 */
	protected void setSearchIcon(int resid) {
		bitmap = BitmapFactory.decodeResource(getResources(), resid);
	}

	/**
	 * 设置搜索icon
	 * 
	 * @param resid
	 */
	protected void setSearchIcon(Drawable drawable) {
		bitmap = ((BitmapDrawable) drawable).getBitmap();
	}

	/**
	 * 设置是否显示搜索icon
	 * 
	 * @param isShowSearchIcon
	 */
	public void setShowSearchIcon(boolean isShowSearchIcon) {
		this.isShowSearchIcon = isShowSearchIcon;
	}

	@Override
	public boolean dispatchTouchEvent(MotionEvent event) {
		final int action = event.getAction();
		final float y = event.getY();
		final int oldChoose = choose;
		final OnTouchingLetterChangedListener listener = onTouchingLetterChangedListener;
		final int c = (int) (y / getHeight() * alphabetList.length);

		switch (action) {
		case MotionEvent.ACTION_DOWN:
			if (oldChoose != c && listener != null) {
				if (c >= 0 && c < alphabetList.length) {
					if (alphabetList[c].equals("#")) {
						if (isShowSearchIcon) {
							listener.onTouchingLetterChanged("搜");
						}
					} else {
						listener.onTouchingLetterChanged(alphabetList[c]);
					}
					choose = c;
					setBackgroundResource(R.drawable.alphabet_list_bg);
					invalidate();
				}
			}

			break;
		case MotionEvent.ACTION_MOVE:
			if (oldChoose != c && listener != null) {
				if (c >= 0 && c < alphabetList.length) {
					if (alphabetList[c].equals("#")) {
						if (isShowSearchIcon) {
							listener.onTouchingLetterChanged("搜");
						}
					} else {
						listener.onTouchingLetterChanged(alphabetList[c]);
					}
					choose = c;
					invalidate();
				}
			}
			break;
		case MotionEvent.ACTION_UP:
			choose = -1;
			setBackgroundDrawable(null);
			invalidate();
			break;
		}
		return true;
	}

	public void setOnTouchingLetterChangedListener(
			OnTouchingLetterChangedListener onTouchingLetterChangedListener) {
		this.onTouchingLetterChangedListener = onTouchingLetterChangedListener;
	}

	public interface OnTouchingLetterChangedListener {
		public void onTouchingLetterChanged(String s);
	}
}

 

 

 

写道
Utils 的实现

 

package com.xiawenquan.test.utils;

import java.util.regex.Pattern;

public class Utils {
	
	/***
	 *获得汉语拼音首字母 
	 *不是字母返回#
	 *是字母返回字母
	 * */ 
	public static String  getAlpha(String str) {
		if (str == null) {
			return "#";
		}

		if (str.trim().length() == 0) {
			return "#";
		}

		char c = str.trim().substring(0, 1).charAt(0);
		// 正则表达式,判断首字母是否是英文字母
		Pattern pattern = Pattern.compile("^[A-Za-z]+$");
		if (pattern.matcher(c + "").matches()) {
			return (c + "").toUpperCase();
		} else {
			return "#";
		}
	}
	
}

 

写道
ConteactMode 的实现

 

 

package com.xiawenquan.test.mode;
/**
 * 封装数据的实体
 * @author xiawenquan
 */
public class ConteactMode {
	
	private String name;
	private String id;
	private String firstAlpha;
	private String phone;
	
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getFirstAlpha() {
		return firstAlpha;
	}
	public void setFirstAlpha(String firstAlpha) {
		this.firstAlpha = firstAlpha;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}

}

 

 

 

package com.xiawenquan.test.adapter;

import java.util.ArrayList;

import com.xiawenquan.test.asyncqueryhandler.R;
import com.xiawenquan.test.mode.ConteactMode;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class 
写道
ContactAdapter 的实现
 
extends BaseAdapter {

	private Context context;
	private ArrayList<ConteactMode> modes;
	
	public ContactAdapter(Context context){
		this.context = context;
	}
	
	
	public void setData(ArrayList<ConteactMode> modes){
		this.modes = modes;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return modes != null && modes.size() > 0 ? modes.size() : 0;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return modes != null && modes.size() > 0 ? modes.get(position) : null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder ;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(R.layout.alphalistview_item, null);
			
			holder.fistAlphaTextView = (TextView) convertView.findViewById(R.id.first_alpha);
			holder.nameTextView = (TextView) convertView.findViewById(R.id.name);
			holder.phoneTextView = (TextView) convertView.findViewById(R.id.phone);
			
			convertView.setTag(holder);
		}else{
			
			holder = (ViewHolder) convertView.getTag();
			
		}
		
		if(modes != null && modes.size() > 0){
			ConteactMode conteactMode = modes.get(position);
			if(conteactMode != null){
				
				//名称
				String name = conteactMode.getName();
				if(!TextUtils.isEmpty(name)){
					holder.nameTextView.setText(name);
				}
				
				//电话
				String phone = conteactMode.getPhone();
				if(!TextUtils.isEmpty(name)){
					holder.phoneTextView.setText(phone);
				}
				
				
				//首字母(前后两项对比字母是否相同,如果相同则过滤,否则添加进来)
				String currentAlpha = conteactMode.getFirstAlpha();
				ConteactMode mode = (position - 1) >= 0 ? modes.get(position - 1)  : null;
				String previewStr = "";
				if(mode != null){
					previewStr = mode.getFirstAlpha();
				}
				
				if (!previewStr.equals(currentAlpha)) {
					holder.fistAlphaTextView.setVisibility(View.VISIBLE);
					holder.fistAlphaTextView.setText(currentAlpha);
				}else{
					holder.fistAlphaTextView.setVisibility(View.GONE);
				}
			}
		}
		
		
		return convertView;
	}
	
	class ViewHolder{
		TextView fistAlphaTextView;
		TextView nameTextView;
		TextView phoneTextView;
	}

}

 

 

 

写道
MainActivity 的实现
 
package com.xiawenquan.test.asyncqueryhandler;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.regex.Pattern;

import com.xiawenquan.test.adapter.ContactAdapter;
import com.xiawenquan.test.mode.ConteactMode;
import com.xiawenquan.test.utils.Utils;
import com.xiawenquan.test.widget.AlphabetListView;

import android.app.Activity;
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.widget.CursorAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
/**
 * 简单使用AsyncQueryHandler
 * @author xianweuqan
 *
 */
@SuppressWarnings("unused")
public class MainActivity extends Activity {

	private ArrayList<ConteactMode> modes;
	protected QueryHandler mQueryHandler;
	protected Cursor mCursor = null;
	private AlphabetListView listView;
	private HashMap<String, Integer> alphaIndexer ;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//定义要查询的数据
		Uri uri = Uri.parse("content://com.android.contacts/data/phones");
		
		getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
		setContentView(R.layout.activity_main);

		modes = new ArrayList<ConteactMode>();
		listView = (AlphabetListView) findViewById(R.id.mylistview);
		//在这里加上加载框
		mQueryHandler = new QueryHandler(getContentResolver());
		query(uri);
	}

	/**
	 * 查询数据
	 * @param uri 数据的路径
	 */
	private void query(Uri uri) {
		
		String[] projection = { "_id", "display_name", "data1", "sort_key" };
		mQueryHandler.startQuery(0, null, uri, projection, null, null,
				"sort_key COLLATE LOCALIZED asc");//按字母排序

	}

	@Override
	protected void onStop() {
		super.onStop();
		if (mCursor != null) {
			mCursor.deactivate();
		}
	}

	class QueryHandler extends AsyncQueryHandler {

		public QueryHandler(ContentResolver cr) {
			super(cr);
		}

		@Override//查询完成后调用此方法
		protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
			super.onQueryComplete(token, cookie, cursor);
			setData(cursor);
			//在这里取消加载框
		}
	}
	
	/**
	 * 绑定数据
	 * @param cursor 游标
	 */
	  
	private void setData(Cursor cursor){
		if(cursor != null && cursor.getCount() > 0){
			if(alphaIndexer == null){
				alphaIndexer = new HashMap<String, Integer>();
				cursor.moveToFirst();
				for (int i = 0; i < cursor.getCount(); i++) {
					
					cursor.moveToPosition(i);
					//取出每一条数据
					String name = cursor.getString(1);
					String phone = cursor.getString(2);
					String sortKey = cursor.getString(3);
					
					//过滤"+86"
					if(phone.startsWith("+86")){
						phone = phone.substring(3);
					}
					
					//把数据封装在实体中
					ConteactMode mode = new ConteactMode();
					mode.setName(name);
					mode.setPhone(phone);
					
					String firstAlpha = Utils.getAlpha(sortKey);
					mode.setFirstAlpha(firstAlpha);
					//将封装的实体加到数组中
					modes.add(mode);
					
				}
				
				
				for(int i = 0 ; i < modes.size() ; i++){
					//处理当点击某一个字母后,其内容出现在屏幕可见状态下的最上面
					ConteactMode conteactMode = modes.get(i);
					String currentAlpha = conteactMode.getFirstAlpha();
					ConteactMode mode = (i - 1) >= 0 ? modes.get(i - 1)  : null;
					String previewStr = "";
					if(mode != null){
						previewStr = mode.getFirstAlpha();
					}
					if (!previewStr.equals(currentAlpha)) {
						alphaIndexer.put(currentAlpha,i);
					}
				}
				
				//把数据设置到adapter
				ContactAdapter adapter = new ContactAdapter(getApplicationContext());
				adapter.setData(modes);
				
				listView.setAlphabetIndex(alphaIndexer);
				listView.setAdapter(adapter);
				
			}
		}
	}
	
}

 

 

写道
最后附有源码,通过学习。
  • 大小: 69.9 KB
分享到:
评论

相关推荐

    IndexListView

    在Android开发中,ListView是一种常用的视图组件,用于展示大量数据列表。`IndexListView`是ListView的一个增强版,它增加了快速滚动和首字母匹配的功能,常用于类似联系人应用的场景,用户可以通过字母索引栏快速...

    网络编程Netty框架深度解析:NIO核心技术、线程模型与高性能网络应用设计

    内容概要:本文档详细介绍了Netty框架的核心概念、特点、线程模型、序列化协议选择及其实现细节。首先对比了BIO、NIO和AIO的区别,重点阐述了NIO的非阻塞特性及其基于事件驱动的工作原理。接着深入讲解了Netty的高性能表现,包括零拷贝技术、心跳机制、内存管理、流量整形等方面。文档还探讨了Netty的线程模型,包括单线程、多线程和主从多线程模型,并解释了NIOEventLoopGroup的源码实现。此外,文档讨论了TCP粘包/拆包问题及其解决方案,以及常见的序列化协议(如JSON、Protobuf、Thrift等)的特点和适用场景。 适合人群:具备一定网络编程基础,特别是对Java NIO和Netty框架有一定了解的研发人员和技术专家。 使用场景及目标:①理解NIO与传统BIO的区别,掌握NIO的非阻塞特性和事件驱动模型;②深入了解Netty的高性能设计原则,包括零拷贝、心跳检测、内存管理和线程模型;③掌握TCP粘包/拆包的原理及解决方案;④根据具体应用场景选择合适的序列化协议。 阅读建议:本文档内容较为深入,建议读者在阅读过程中结合实际代码和应用场景进行理解。对于Netty的线程模型和序列化协议部分,可以通过实际编程练习加深理解。特别地,理解NIOEventLoopGroup的源码实现需要有一定的Java多线程编程基础。

    美高森美提供的SmartFusion2 SoC FPGA双轴电机控制套件带有模块化电机控制IP集和参考设计.doc

    美高森美提供的SmartFusion2 SoC FPGA双轴电机控制套件带有模块化电机控制IP集和参考设计.doc

    基于三菱FX1S PLC和威纶通触摸屏的双伺服打孔机控制系统开发详解

    内容概要:本文详细介绍了使用三菱FX1S系列PLC和威纶通触摸屏构建双伺服打孔机控制系统的开发过程。主要内容涵盖系统架构、PLC程序设计、触摸屏配置以及开发中常见的注意事项。系统的核心在于通过PLC控制伺服电机完成精确的打孔动作,触摸屏则用于参数设置和运行监控。文中还讨论了伺服电机的参数配置、循环控制逻辑、MODBUS通信配置、界面设计及实时数据更新等方面的内容。此外,作者分享了一些实际开发中的经验和教训,如伺服电机的过冲和欠冲问题、程序稳定性的保障措施以及触摸屏响应速度的优化。 适合人群:从事自动化控制领域的工程师和技术人员,尤其是对PLC编程和伺服控制有一定基础的人群。 使用场景及目标:适用于需要高精度定位和控制的工业应用场景,如钣金加工车间。目标是帮助读者掌握双伺服打孔机的开发流程,提高系统的稳定性和效率。 其他说明:文中提到的技术细节和实践经验对于理解和解决类似项目的难题非常有帮助。建议读者在实践中结合具体情况进行调整和优化。

    太远市-小店区-街道行政区划_140105_Shp数据-wgs84坐标系 (1).rar

    街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用

    乌兰察布市-乌兰察布市-街道行政区划_150900_Shp数据-wgs84坐标系.rar

    街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用

    呼伦贝尔市-满洲里市-街道行政区划_150781_Shp数据-wgs84坐标系.rar

    呼伦贝尔市-满洲里市-街道行政区划_150781_Shp数据-wgs84坐标系.rar

    临汾市-尧都区-街道行政区划_141002_Shp数据-wgs84坐标系.rar

    街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用

    Java基于springboot+vue的资产管理系统源码+数据库(高分项目)

    Java基于springboot+vue的资产管理系统源码+数据库(高分项目),个人经导师指导并认可通过的高分设计项目,评审分99分,代码完整确保可以运行,小白也可以亲自搞定,主要针对计算机相关专业的正在做大作业的学生和需要项目实战练习的学习者,可作为毕业设计、课程设计、期末大作业。 Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据库(高分项目)Java基于springboot+vue的资产管理系统源码+数据

    吕梁市-吕梁市-街道行政区划_141100_Shp数据-wgs84坐标系.rar

    街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用

    邢台市-巨鹿县--街道行政区划_130529_Shp-wgs84坐标系.rar

    街道级行政区划shp数据,wgs84坐标系,直接下载使用。

    石家庄市-石家庄市-石家庄市-石家庄市-街道行政区划_130100_Shp数据wgs84坐标系.rar

    街道级行政区划shp数据,wgs84坐标系,直接下载使用。

    北京市-昌平区-街道行政区_110114_shp-wgs84坐标系.rar

    街道级行政区划shp数据,wgs84坐标系,直接使用。

    朔州市-朔城区-街道行政区划_140602_Shp数据-wgs84坐标系.rar

    街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用

    石家庄市-石家庄市-石家庄市-行唐县-街道行政区划_130125_Shp数据wgs84坐标系.rar

    街道级行政区划shp数据,wgs84坐标系,直接下载使用。

    鄂尔多斯市-乌审旗-街道行政区划_150626_Shp数据-wgs84坐标系.rar

    鄂尔多斯市-乌审旗-街道行政区划_150626_Shp数据-wgs84坐标系.rar

    Thinkphp蓝色大气的响应式轻量级通用后台,采用Bootstrap3制作,自带权限管理功能

    适用范围:Thinkphp蓝色响应式后台源码 系统设置、导航管理、配置管理、上传管理、用户管理、功能模块和插件管理 源码开发语言:PHP+MYSQL 源码描述说明: thinkphp蓝色大气的响应式后台模板,常用的后台功能有:系统设置、导航管理、配置管理、上传管理、用户管理、功能模块和插件管理等。

    大同市-云冈区-街道行政区划_140214_Shp数据-wgs84坐标系.rar

    大同市-云冈区-街道行政区划_140214_Shp数据-wgs84坐标系.rar

    脑机接口基于FBCCA算法与贝叶斯优化的SSVEP分类器设计及优化:含高斯过程优化完整代码实现与性能分析如何在FBCCA

    内容概要:本文详细介绍了在FBCCA算法中应用贝叶斯优化的完整代码实现,基于高斯过程优化,代码可直接运行。首先配置环境,安装所需的Python库如scikit-optimize、scipy、numpy、torch等。核心实现部分包括数据生成模块,通过SSVEPGenerator类生成带谐波的SSVEP信号FBCCABayes分类器模块,定义了滤波器组的动态创建、CCA相关系数的计算,并实现了贝叶斯优化过程。最后,通过贝叶斯优化执行模块,对FBCCABayes分类器的关键参数(滤波器阶数、频带宽度、CCA权重系数)进行优化,输出最佳参数组合及最高验证准确率,并对优化过程进行可视化展示,包括收敛曲线和参数影响热力图。 适合人群:有一定机器学习基础,特别是熟悉Python编程和贝叶斯优化理论的研究人员或工程师。 使用场景及目标:①理解FBCCA算法的工作原理及其在脑机接口领域的应用;②掌握贝叶斯优化在调参中的具体应用,提高模型性能;③学习如何将理论知识转化为实际可运行的代码,并通过可视化工具直观地展示优化效果。 其他说明:代码已在Python 3.10 + CUDA 11.8/CPU环境下验证通过,安装指定版本依赖后可直接运行。建议读者在实践中调整参数设置,探索不同配置下的模型表现。

Global site tag (gtag.js) - Google Analytics