`

左边可拖出菜单(页面)效果

阅读更多



这个效果现在很多软件都实现了,其实说穿了很简单的。就是一个动画,做的地道点的加一个手势拖拉效果。
我写的代码(未参考任何代码,不知道别人怎么实现的。):
import java.util.ArrayList;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.AbsoluteLayout;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class SlideRightActivity extends BaseActivity implements OnTouchListener,OnGestureListener{
	private Context context;
	private Button btn;
	private LinearLayout left_panel,right_panel;
	private boolean isShowing=false;
	private final int duration=200;
	
	//
	private GestureDetector mGestureDetector; 
//	private ViewGroup container;
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_right);
        context=this;
        initViews();
    }

	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		initValues();
	}

	@Override
	protected void updateViews(Object o) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void initViews() {
		// TODO Auto-generated method stub
//		container=(ViewGroup)findViewById(R.id.container);
		left_panel=(LinearLayout)findViewById(R.id.left_panel);
		left_panel.setLayoutParams(new AbsoluteLayout.LayoutParams((int)(getResources().getDisplayMetrics().widthPixels*0.8), AbsoluteLayout.LayoutParams.MATCH_PARENT, 0, 0));
		right_panel=(LinearLayout)findViewById(R.id.right_panel);
		
		right_panel.setOnTouchListener(this);
		//定义手势识别  
		mGestureDetector = new GestureDetector(this,this);  
		mGestureDetector.setIsLongpressEnabled(false);
		
		ArrayList<String> list=new ArrayList<String>();
		list.add("1");
		list.add("2");
		list.add("3");
		list.add("4");
		list.add("5");
		list.add("6");
		ListView listView=(ListView)findViewById(R.id.listView);
		ListViewAdapter adapter=new ListViewAdapter(list);
		listView.setAdapter(adapter);
		
		
		btn=(Button)findViewById(R.id.btn);
		btn.setOnClickListener(onClickListener);
		ArrayList<String> texts=new ArrayList<String>();
  		texts.add("111");
  		texts.add("222");
  		texts.add("333");
  		texts.add("444");
  		texts.add("555");
  		texts.add("666");
  		texts.add("777");
  		ListView listViewBeside=(ListView)findViewById(R.id.listViewBeside);
  		ListViewAdapter adapterBeside=new ListViewAdapter(texts);
  		listViewBeside.setAdapter(adapterBeside);
  		/**让ListView不拦截手势滑动*/
  		listViewBeside.setOnTouchListener(new View.OnTouchListener(){

			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				doSlideWhenTouchUp(event);
				mGestureDetector.onTouchEvent(event);
				return false;
			}
  			
  		});
    
  		listViewBeside.setOnItemClickListener(new ListView.OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub
				Log.i("tag", "position=="+position);
			}
		});
  		
	}

	View.OnClickListener onClickListener=new View.OnClickListener(){

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			int width=left_panel.getMeasuredWidth();
			if(isShowing){
				doSlideCloseAnimation(right_panel,width);
			}else{
				doSlideOpenAnimation(right_panel,width);
			}
		}
		
	};
	
	@Override
	protected void initValues() {
		// TODO Auto-generated method stub
	}

	@Override
	protected void initHandler() {
		// TODO Auto-generated method stub

	}
	
	
	private void doSlideOpenAnimation(View v,int width) {
		TranslateAnimation animation = new TranslateAnimation(0, width, 0, 0);
		animation.setInterpolator(new LinearInterpolator());
		animation.setDuration(duration);
		animation.setFillAfter(true);
		v.startAnimation(animation);
		animation.setAnimationListener(new AnimationListener(){

			@Override
			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onAnimationEnd(Animation animation) {
				// TODO Auto-generated method stub
				resetLayout(left_panel.getMeasuredWidth(),0);
                isShowing=true;
			}

			@Override
			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub
				
			}
			
		});
	}

	private void resetLayout(int width,int height){
		AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams)right_panel.getLayoutParams();
		params.x=width;
		params.y=height;
		right_panel.setLayoutParams(params);
		right_panel.clearAnimation();
	}
	
	private void doSlideCloseAnimation(View v,final int width) {
		TranslateAnimation animation = new TranslateAnimation(0, -width, 0, 0);
		animation.setInterpolator(new LinearInterpolator());
		animation.setDuration(duration);
		animation.setFillAfter(true);
		v.startAnimation(animation);
		animation.setAnimationListener(new AnimationListener(){

			@Override
			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onAnimationEnd(Animation animation) {
				// TODO Auto-generated method stub
				resetLayout(0,0);
				isShowing=false;
			}

			@Override
			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
	}
	
	class ListViewAdapter extends BaseAdapter{

		private ArrayList<String> list;
		public ListViewAdapter(ArrayList<String> list){
			this.list=list;
		}
		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return list.size();
		}

		@Override
		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return list.get(position);
		}

		@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
			if (convertView == null) {
				convertView = LayoutInflater.from(context).inflate(
						R.layout.simple_item_1_for_listview, null);
			}
			TextView tv0=(TextView)convertView.findViewById(R.id.simple_item_0);
			tv0.setText(list.get(position));
			return convertView;
		}
		
	}

	@Override
	public boolean onDown(MotionEvent e) {
		// TODO Auto-generated method stub
		return true;
	}


	@Override
	public void onShowPress(MotionEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		// TODO Auto-generated method stub
		return false;
	}

	private int mScrollx;
	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
			float distanceY) {
		// TODO Auto-generated method stub
		mScrollx -= distanceX;//distanceX:向左为正,右为负
		AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams)right_panel.getLayoutParams();
		params.x+=mScrollx;//distanceX:向左为正,右为负
		if(params.x>left_panel.getMeasuredWidth()){
			params.x=left_panel.getMeasuredWidth();
		}
		if(params.x<0){
			params.x=0;
		}
		right_panel.setLayoutParams(params);
		return false;
	}


	@Override
	public void onLongPress(MotionEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
			float velocityY) {
		// TODO Auto-generated method stub
		/** 手势快速滑动,打开/关闭panel。现已被onScroll()完成同样的功能 */
		/*int width=left_panel.getMeasuredWidth();
		if(velocityX>500){
			if(!isShowing)
				if(right_panel.getLeft()==0)
					doSlideOpenAnimation(right_panel, width);
		}else if(velocityX<-500){
			if(isShowing)
				if(right_panel.getLeft()==width)
					doSlideCloseAnimation(right_panel, width);
		}*/
		return false;
	}


	@Override
	public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub
		doSlideWhenTouchUp(event);
		return mGestureDetector.onTouchEvent(event);
	}
	
	private void doSlideWhenTouchUp(MotionEvent event){
		switch (event.getAction()) {
		case MotionEvent.ACTION_UP:
			/** 手势拖动到一 半松手时,根据拖动的距离判断打开/关闭 */
			AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams)right_panel.getLayoutParams();
			int width=left_panel.getMeasuredWidth();
			int slideDistance=width>>1;
			if (params.x >= slideDistance) {
				doSlideOpenAnimation(right_panel, width-params.x);
			}else{
				doSlideCloseAnimation(right_panel, params.x);
			}
		default:
			break;
		}
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		return super.onKeyDown(keyCode, event);
	}
	
	 
}


布局:
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    >

    <LinearLayout
        android:id="@+id/left_panel"
        android:layout_width="250dp"
        android:layout_height="fill_parent"
        android:orientation="vertical" 
        android:layout_x="0dp"
        android:layout_y="0dp"
        >
        <ListView 
	    android:id="@+id/listView"
	    android:layout_width="fill_parent"
    	android:layout_height="fill_parent" 
    	android:cacheColorHint="@android:color/transparent"
	    />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/right_panel"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" 
        android:background="@color/green"
        android:layout_x="0dp"
        android:layout_y="0dp"
        >
        <Button
            android:id="@+id/btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="open/close" />

        <ListView
            android:id="@+id/listViewBeside"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="@android:color/transparent" />
    </LinearLayout>

</AbsoluteLayout>


如果不加手势的话,其实也可以的:
import java.util.ArrayList;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.AbsoluteLayout;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class SlideRightActivity extends BaseActivity implements OnTouchListener/*,OnGestureListener*/{
	private Context context;
	private Button btn;
	private LinearLayout left_panel,right_panel;
	private boolean isShowing=false;
	private final int duration=200;
//	private GestureDetector mGestureDetector; 
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_right);
        context=this;
        initViews();
    }

	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		initValues();
	}

	@Override
	protected void updateViews(Object o) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void initViews() {
		// TODO Auto-generated method stub
		left_panel=(LinearLayout)findViewById(R.id.left_panel);
		left_panel.setLayoutParams(new AbsoluteLayout.LayoutParams((int)(getResources().getDisplayMetrics().widthPixels*0.8), AbsoluteLayout.LayoutParams.MATCH_PARENT, 0, 0));
		right_panel=(LinearLayout)findViewById(R.id.right_panel);
		
		right_panel.setOnTouchListener(this);
		//定义手势识别  
//		mGestureDetector = new GestureDetector(this,this);  
//		mGestureDetector.setIsLongpressEnabled(false);
		
		ArrayList<String> list=new ArrayList<String>();
		list.add("1");
		list.add("2");
		list.add("3");
		list.add("4");
		list.add("5");
		list.add("6");
		ListView listView=(ListView)findViewById(R.id.listView);
		ListViewAdapter adapter=new ListViewAdapter(list);
		listView.setAdapter(adapter);
		
		
		btn=(Button)findViewById(R.id.btn);
		btn.setOnClickListener(onClickListener);
		ArrayList<String> texts=new ArrayList<String>();
  		texts.add("111");
  		texts.add("222");
  		texts.add("333");
  		texts.add("444");
  		texts.add("555");
  		texts.add("666");
  		texts.add("777");
  		ListView listViewBeside=(ListView)findViewById(R.id.listViewBeside);
  		ListViewAdapter adapterBeside=new ListViewAdapter(texts);
  		listViewBeside.setAdapter(adapterBeside);
  		/**让ListView不拦截手势滑动*/
  		listViewBeside.setOnTouchListener(new View.OnTouchListener(){

			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				doSlideWhenTouchUp(event);
//				mGestureDetector.onTouchEvent(event);
				return false;
			}
  			
  		});
    
  		listViewBeside.setOnItemClickListener(new ListView.OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub
				Log.i("tag", "position=="+position);
			}
		});
  		
	}

	View.OnClickListener onClickListener=new View.OnClickListener(){

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			int width=left_panel.getMeasuredWidth();
			if(isShowing){
				doSlideCloseAnimation(right_panel,width);
			}else{
				doSlideOpenAnimation(right_panel,width);
			}
		}
		
	};
	
	@Override
	protected void initValues() {
		// TODO Auto-generated method stub
	}

	@Override
	protected void initHandler() {
		// TODO Auto-generated method stub

	}
	
	
	private void doSlideOpenAnimation(View v,int width) {
		TranslateAnimation animation = new TranslateAnimation(0, width, 0, 0);
		animation.setInterpolator(new LinearInterpolator());
		animation.setDuration(duration);
		animation.setFillAfter(true);
		v.startAnimation(animation);
		animation.setAnimationListener(new AnimationListener(){

			@Override
			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onAnimationEnd(Animation animation) {
				// TODO Auto-generated method stub
				resetLayout(left_panel.getMeasuredWidth(),0);
                isShowing=true;
			}

			@Override
			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub
				
			}
			
		});
	}

	private void resetLayout(int width,int height){
		AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams)right_panel.getLayoutParams();
		params.x=width;
		params.y=height;
		right_panel.setLayoutParams(params);
		right_panel.clearAnimation();
	}
	
	private void doSlideCloseAnimation(View v,final int width) {
		TranslateAnimation animation = new TranslateAnimation(0, -width, 0, 0);
		animation.setInterpolator(new LinearInterpolator());
		animation.setDuration(duration);
		animation.setFillAfter(true);
		v.startAnimation(animation);
		animation.setAnimationListener(new AnimationListener(){

			@Override
			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onAnimationEnd(Animation animation) {
				// TODO Auto-generated method stub
				resetLayout(0,0);
				isShowing=false;
			}

			@Override
			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
	}
	
	class ListViewAdapter extends BaseAdapter{

		private ArrayList<String> list;
		public ListViewAdapter(ArrayList<String> list){
			this.list=list;
		}
		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return list.size();
		}

		@Override
		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return list.get(position);
		}

		@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
			if (convertView == null) {
				convertView = LayoutInflater.from(context).inflate(
						R.layout.simple_item_1_for_listview, null);
			}
			TextView tv0=(TextView)convertView.findViewById(R.id.simple_item_0);
			tv0.setText(list.get(position));
			return convertView;
		}
		
	}

	/*@Override
	public boolean onDown(MotionEvent e) {
		// TODO Auto-generated method stub
		return true;
	}


	@Override
	public void onShowPress(MotionEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		// TODO Auto-generated method stub
		return false;
	}

	private int mScrollx;
	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
			float distanceY) {
		// TODO Auto-generated method stub
		mScrollx -= distanceX;//distanceX:向左为正,右为负
		AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams)right_panel.getLayoutParams();
		params.x+=mScrollx;//distanceX:向左为正,右为负
		if(params.x>left_panel.getMeasuredWidth()){
			params.x=left_panel.getMeasuredWidth();
		}
		if(params.x<0){
			params.x=0;
		}
		right_panel.setLayoutParams(params);
		return false;
	}


	@Override
	public void onLongPress(MotionEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
			float velocityY) {
		// TODO Auto-generated method stub
		return false;
	}*/


	@Override
	public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub
//		doSlideWhenTouchUp(event);
//		return mGestureDetector.onTouchEvent(event);
		Log.i("tag", "Action="+event.getAction());
		doSlideWhenTouchUp(event);
		return true;
	}
	
	private VelocityTracker tracker = null;//速度跟踪器,用于判断偏左还是偏右
	private boolean direction=true;//向左or向右拉
	private void doSlideWhenTouchUp(MotionEvent event){
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			if(tracker == null){  
                tracker = VelocityTracker.obtain();    
            }else{  
                tracker.clear();   
            }  
            tracker.addMovement(event);
			break;
		case MotionEvent.ACTION_UP:
			tracker.recycle();
			/** 手势拖动到一 半松手时,根据拖动的距离判断打开/关闭 */
			AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams)right_panel.getLayoutParams();
			int width=left_panel.getMeasuredWidth();
			int slideDistance=width/3;
			if(direction){
				if (params.x >= slideDistance) {
					doSlideOpenAnimation(right_panel, width-params.x);
				}else{
					doSlideCloseAnimation(right_panel, params.x);
				}
			}else{
				if (params.x >= width-slideDistance) {
					doSlideOpenAnimation(right_panel, width-params.x);
				}else{
					doSlideCloseAnimation(right_panel, params.x);
				}
			}
		case MotionEvent.ACTION_MOVE:
			tracker.addMovement(event);    
            tracker.computeCurrentVelocity(1000); 
			float  XVelocity=tracker.getXVelocity()*0.02f;//0.02是速度系数,这个根据手机世纪表现调出来的
			if(XVelocity<0){//向左划
				direction=false;
			}else{//向右划
				direction=true;
			}
//			Log.i("tag", "XVelocity="+XVelocity);  
			params = (AbsoluteLayout.LayoutParams)right_panel.getLayoutParams();
			params.x+=XVelocity;//distanceX:向左为正,右为负
			if(params.x>left_panel.getMeasuredWidth()){
				params.x=left_panel.getMeasuredWidth();
			}
			if(params.x<0){
				params.x=0;
			}
			right_panel.setLayoutParams(params);
			break;
		default:
			break;
		}
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		return super.onKeyDown(keyCode, event);
	}
	
	 
}
  • 大小: 22.5 KB
分享到:
评论
2 楼 gundumw100 2014-04-02  
PpOo 写道
BaseActivity在哪?

将activity中带@Override的方法去掉@Override即可
1 楼 PpOo 2014-03-31  
BaseActivity在哪?

相关推荐

    在html页面中弹出子页面效果

    在HTML页面中实现弹出子页面的效果是一种常见的交互设计,常用于展示详细信息、弹窗确认操作或提供附加功能。这种效果通常是通过JavaScript或者相关的库如jQuery来实现的。Struts1是一个较老的Java Web框架,它允许...

    VC 实现可拖出主窗口的工具栏效果.rar

    VC 实现可拖出主窗口的工具栏效果,也就是窗口中的工具栏菜单可以整体被拖动,可停靠在窗口内,当靠近主窗体时,会像带有磁性一样吸附在主窗口的某个区域中,有很多播放器的播放列表就是这种窗口设计风格,用户可...

    ios-侧滑菜单,侧滑,QQ侧滑菜单,左边菜单.zip

    在本项目"ios-侧滑菜单,侧滑,QQ侧滑菜单,左边菜单.zip"中,开发者Zws-China实现了一个类似QQ风格的侧滑菜单组件,名为LeftSlide。这个开源库可以帮助开发者轻松地在自己的iOS应用中集成这一功能。 LeftSlide的核心...

    实现QTabWidget拖出拆分窗口,拖入合并窗口,固定标签,关闭标签菜单源码

    在实际的软件开发中,用户有时需要更加灵活的操作方式,比如将标签拖出形成独立的窗口,或者将窗口拖入到`QTabWidget`中进行合并,甚至固定某些标签不被关闭,以及提供关闭标签的菜单选项。这些功能在一些复杂的桌面...

    滑动屏幕拖出菜单效果

    源码DCBlurMenu,手指在导航条上向下滑动屏幕,可以拖拉出菜单,然后手指不离开屏幕继续滑动,可以选择菜单上的某个选项,松开手指后,菜单收回。菜单具有模糊背景的效果。 A blurred swipe down menu designed for...

    特效 大页面切换菜单

    这种菜单通常会在有限的屏幕空间内展示大量信息,通过滑动、缩放或平移等动画效果实现页面间的切换。 大页面切换菜单的设计理念在于优化导航,减少用户的滚动操作,使得用户能够快速定位到他们感兴趣的内容。这种...

    Android 可拖动浮动工具条(菜单)Demo

    通过这个“Android 可拖动浮动工具条(菜单)Demo”,开发者可以学习到如何将触摸事件、布局设计和拖放功能相结合,创造出更加动态和交互性的UI组件。实践中,你可以下载FloatBarDemo这个项目,通过查看源代码和运行...

    导航菜单主页面

    在Windows Forms应用开发中,导航菜单是...通过合理的菜单设计和适当的事件处理,开发者可以构建出符合用户习惯、操作便捷的导航菜单主页面。在实际项目中,结合其他控件和功能,可以构建出功能完善的桌面应用程序。

    托盘+菜单控件(可以实现托盘以及带有图片的菜单)

    标题中的“托盘+菜单控件(可以实现托盘以及带有图片的菜单)”是指一种用于Windows应用程序开发的组件,它允许开发者轻松地在系统托盘区创建图标,并且该图标关联的右键菜单还能显示带有图片的选项。这种控件提高了...

    C#简单的折叠菜单

    这些子菜单项可以进一步包含自己的子菜单,形成折叠效果。 步骤四:设置事件处理程序。当你点击菜单项时,通常需要执行一些操作。双击菜单项,Visual Studio会自动为它生成一个Click事件处理程序。在处理程序中编写...

    VB导航菜单 仿QQ菜单

    这个控件的设计目的是提供一个简单、直观且可自定义的方式来构建用户界面,使得开发者能够轻松地为应用程序添加专业级别的菜单功能。 在VB中,通常我们使用MenuStrip或MenuStrip控件来创建菜单项,但这些控件可能...

    visual c++给菜单项左边添加个图标

    诺特”和“WTL菜单项图标 - 拖拖拉拉的册子 - CSDN博客”可能提供了更多关于美化菜单和使用WTL的具体技巧和实践案例,值得参考。 总结来说,为Visual C++菜单项添加图标涉及到资源管理、菜单操作以及适当类库的使用...

    swift-点击出现的下拉菜单简单设置数据源就可以实现效果

    在本篇文章中,我们将深入探讨如何使用Swift来创建一个点击后显示下拉菜单的控件,并通过简单设置数据源来实现这一效果。 首先,我们要了解Swift中的下拉菜单其实是一种自定义视图,通常基于UIView或者...

    用Axure制作页面滚动时菜单固定在顶部的页面.rp

    用Axure制作页面滚动时菜单固定在顶部的页面 1.在Axure工作区中拖入4个矩形,分别为Head,Tab,content和bottom,其中content长一些 2.复制tab为tab2,坐标x与tab相同,坐标y为0,转化tab2为动态模板,并设置为隐藏 ...

    js树形菜单实现拖动效果

    此外,还要考虑边界限制,确保元素不会被拖出可视区域。 总的来说,实现JS树形菜单的拖动效果需要结合HTML、CSS、JavaScript、Ajax和XML等多种技术。这个过程涉及到DOM操作、事件处理、数据解析和用户交互设计等多...

    VB6多风格弹出菜单控件源码

    此外,菜单颜色的可修改性也是该控件的一大亮点。VB6默认的菜单颜色可能无法满足所有设计需求,而此控件允许开发者修改菜单项的颜色、背景色、高亮色等,以达到最佳的视觉效果。通过调整这些颜色属性,开发者可以...

    带左侧展开菜单的Delphi漂亮界面..rar

    要实现左侧展开菜单的效果,我们通常会使用TTreeView或TListView组件。TTreeView适用于层次结构的数据展示,可以模拟Windows资源管理器的树状结构,而TListView则提供更灵活的视图模式,包括报告、图标和详细信息等...

    delphi推拉式菜单实例

    4. 使用Popup方法动态弹出子菜单,模拟推拉效果。 5. 可选地,添加视觉反馈增强用户体验。 通过以上步骤,你可以在Delphi中创建出功能完备、用户体验良好的推拉式菜单。这个实例不仅适用于初学者理解Delphi的菜单...

    Delphi XE7实现的任意位置弹出菜单

    在Delphi XE7中,实现一个任意位置弹出菜单是一项常见的编程任务,这涉及到对Windows API的理解,以及对Delphi组件的熟练运用。本文将深入探讨如何在Delphi XE7环境中创建一个可以在屏幕任意位置显示的弹出菜单。 ...

    立体页面效果.rar立体页面效果.rar

    其次,过于复杂的3D效果可能会拖慢页面加载速度,影响用户体验。因此,在设计时需平衡视觉冲击力与性能之间的关系。 总的来说,立体页面效果是网页设计的一大进步,它为设计师提供了更多创造性的表达空间,并能提升...

Global site tag (gtag.js) - Google Analytics