热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Android实现旋转键盘的例子

效果图单个图片的类DJItemImageView.javapackagecom.ldci.djrotatemenuforandroid;importandroid.content



效果图



单个图片的类

DJItemImageView.java

package com.ldci.djrotatemenuforandroid;import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;public class DJItemImageView extends RelativeLayout implements OnClickListener{public ImageView imageView;public DJItemImageView(Context context) {super(context);//this.setBackgroundColor(Color.GREEN);//设置该布局的属性RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);lp1.addRule(RelativeLayout.CENTER_HORIZONTAL);lp1.addRule(RelativeLayout.CENTER_VERTICAL);// TODO Auto-generated constructor stubimageView = new ImageView(context);imageView.setRotation(180);Bitmap bitmap = ((BitmapDrawable)getResources().getDrawable(R.drawable.ui_navi_course_in)).getBitmap();//设置图片的属性RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(bitmap.getWidth(), bitmap.getHeight());//RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);lp.addRule(RelativeLayout.CENTER_VERTICAL);imageView.setLayoutParams(lp);//imageView.setImageBitmap(bitmap);imageView.setOnClickListener(this);this.addView(imageView);// lp1.width = bitmap.getWidth() * 3;// lp1.height = bitmap.getHeight();this.setLayoutParams(lp1);}public void setImageTag(int tagId) {imageView.setId(tagId);Log.i("image", "imageItem tag" + tagId);}public void djsetImageResources(int imageId) {Bitmap bitmap = ((BitmapDrawable)getResources().getDrawable(imageId)).getBitmap();imageView.setImageBitmap(bitmap);}@Overridepublic void onClick(View v) {Log.i("image", "1111111111111111111111111111" + v.getId());// TODO Auto-generated method stubswitch (v.getId()) {case 1001:Log.i("image", "1111111111111111111111111111");break;case 1002:Log.i("image", "222222222222222222222222222222");break;case 1003:Log.i("image", "33333333333333333333333333333");break;case 1004:Log.i("image", "444444444444444444444444444");break;case 1005:Log.i("image", "5555555555555555555555555555");break;case 1006:Log.i("image", "66666666666666666666666666");break;case 10000:Log.i("image", "777777777777777777777");break;default:break;}}}




6个图片的第一次集合类

DJRotateRelativeLayout.java

package com.ldci.djrotatemenuforandroid;import java.util.ArrayList;import android.R.integer;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;public class DJRotateRelativeLayout extends RelativeLayout{private int imageIdsDefault[] &#61; {R.drawable.ui_navi_home,R.drawable.ui_navi_feature,R.drawable.ui_navi_course,R.drawable.ui_navi_listen,R.drawable.ui_navi_play,R.drawable.ui_navi_more};private int imageIdsIn[] &#61; {R.drawable.ui_navi_home_in,R.drawable.ui_navi_feature_in,R.drawable.ui_navi_course_in,R.drawable.ui_navi_listen_in,R.drawable.ui_navi_play_in,R.drawable.ui_navi_more_in};private ArrayList djArrayList;public DJRotateRelativeLayout(Context context) {super(context);// TODO Auto-generated constructor stub//初始化一个数字djArrayList &#61; new ArrayList();this.setBackgroundColor(Color.TRANSPARENT);RelativeLayout.LayoutParams bglp &#61; new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);bglp.addRule(RelativeLayout.CENTER_HORIZONTAL);bglp.addRule(RelativeLayout.CENTER_VERTICAL);this.setLayoutParams(bglp);//this.setOnTouchListener(this);ImageView bgImageViewimageView &#61; new ImageView(context);bgImageViewimageView.setLayoutParams(bglp);Bitmap bgbitmap &#61; ((BitmapDrawable)getResources().getDrawable(R.drawable.ui_navi_bg)).getBitmap();bgImageViewimageView.setImageBitmap(bgbitmap);this.addView(bgImageViewimageView);RelativeLayout.LayoutParams lp &#61; new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);// lp.addRule(CENTER_VERTICAL);this.setLayoutParams(lp);for (int i &#61; 1; i <7; i&#43;&#43;) {DJItemImageView djItemImageView &#61; new DJItemImageView(context);djItemImageView.setRotation(240- (60 * i));djArrayList.add(djItemImageView);int tagItem &#61; i &#43; 1000;djItemImageView.setImageTag(tagItem);djItemImageView.djsetImageResources(imageIdsDefault[i - 1]);System.out.println(tagItem);this.addView(djItemImageView);}}public void changeImageDefaultResources(int imageId) {DJItemImageView inDjItemImageView &#61; djArrayList.get(imageId);inDjItemImageView.djsetImageResources(imageIdsDefault[imageId]);}public void changeImageResoures(int imageId) {System.out.println(imageId);DJItemImageView inDjItemImageView &#61; djArrayList.get(imageId);inDjItemImageView.djsetImageResources(imageIdsIn[imageId]);}}


处理旋转功能的类

DJRotateMenuView.java

package com.ldci.djrotatemenuforandroid;import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PointF;
import android.graphics.drawable.BitmapDrawable;
import android.widget.AbsoluteLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.RotateAnimation;public class DJRotateMenuView extends RelativeLayout implements AnimationListener,OnClickListener{//角度private double angle;//旋转角度private double rotate;//现在的角度private double nowDegress;private double previousDegress;//计算角度变化的数据private double degressNum;//按钮间的夹角private double djDegressBtn;//当前的角度private double currentDegree;//屏幕的宽private float winSizeWidth;//高private float winSizeHeight;private boolean selectBoolean;//上一次触摸点的坐标private PointF previousPointF;//目标位置private float destinationAngle;private int previousimageId;private int currentImageId &#61; 0;private int previousImageNum &#61; 90;//private ImageView btnImageView;//private TranslateAnimation translateAnimation;//private RotateAnimation rotateAnimation;// private boolean calBool &#61; true;//中心的点坐标 。。。。。临时 设置的屏幕中心PointF centerPointF;//当前计算机1秒钟的计算能力int myComputerCalculate &#61; 0;private DJRotateRelativeLayout djRotateRelativeLayout;public DJRotateMenuView(Context context,float tempWidth,float tempHeight) {super(context);// this.setBackgroundColor(Color.BLUE);this.winSizeWidth &#61; tempWidth;this.winSizeHeight &#61; tempHeight;this.centerPointF &#61; new PointF(this.winSizeWidth / 2, this.winSizeHeight / 2);previousimageId &#61; 0;djDegressBtn &#61; 360 / 6;// AbsoluteLayout.LayoutParams new_params &#61; new AbsoluteLayout.LayoutParams((int)this.winSizeWidth, (int)this.winSizeHeight, (int)this.winSizeWidth, (int)this.winSizeHeight / 2);djRotateRelativeLayout &#61; new DJRotateRelativeLayout(context);
// djRotateRelativeLayout.setLayoutParams(new_params);this.addView(djRotateRelativeLayout);// djRotateRelativeLayout.setRotation(120);//设置图片djRotateRelativeLayout.changeImageResoures((int)(djRotateRelativeLayout.getRotation() / djDegressBtn));degressNum &#61; 0;// btnImageView &#61; new ImageView(context);
// btnImageView.setId(987654);
// btnImageView.setOnClickListener(this);
//
// Bitmap btnBitmap &#61; ((BitmapDrawable)getResources().getDrawable(R.drawable.ui_navi_triangle)).getBitmap();
// RelativeLayout.LayoutParams btnlp &#61; new RelativeLayout.LayoutParams(btnBitmap.getWidth(),btnBitmap.getHeight());
// btnImageView.setImageBitmap(btnBitmap);
// btnlp.addRule(RelativeLayout.CENTER_HORIZONTAL);
// btnlp.addRule(RelativeLayout.CENTER_VERTICAL);
// //btnlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
//
// btnImageView.setLayoutParams(btnlp);
// this.addView(btnImageView);//btnlp.alignWithParent &#61; false;}public void djTouchBegin(PointF touchPointF) {double distance &#61; djDistance(touchPointF, this.centerPointF);//获取当前图片IDSystem.out.println("distance " &#43; distance);}public void djTouchMove(PointF touchPointF) {PointF previousLocationF &#61; previousPointF;//角度差PointF previousCGP &#61; djCgpSub(previousLocationF, centerPointF);double previousVector &#61; djToAngle(previousCGP);previousDegress &#61; dj_Radians_To_Degrees(previousVector);PointF nowLocation &#61; touchPointF;PointF nowCGP &#61; djCgpSub(nowLocation, centerPointF);double nowVector &#61; djToAngle(nowCGP);nowDegress &#61; dj_Radians_To_Degrees(nowVector);//在这里判断角度angle &#61; -(nowDegress - previousDegress);currentDegree &#61; djRotateRelativeLayout.getRotation();//degressNum &#43;&#61; angle;angle &#43;&#61; currentDegree;djSetRotate(angle);//djChangeImageView();}public void djChangeImageView() {float tempCurrentAngle &#61; djRotateRelativeLayout.getRotation();System.out.println("tempCurrentAngle" &#43; tempCurrentAngle);double currentAngle &#61; djRotateRelativeLayout.getRotation();double currentSub;currentSub &#61; currentAngle / djDegressBtn;int temp &#61; (int)currentSub;currentSub &#61; currentAngle -djDegressBtn * temp;if (currentSub > 0) {if (temp !&#61; previousImageNum) {if (currentSub > djDegressBtn / 2) {currentImageId &#43;&#61; 1;}} }else if (currentSub <0) {if (temp !&#61; previousImageNum) {currentImageId -&#61; 1;}}previousImageNum &#61; temp;if (currentImageId <0) {currentImageId &#43;&#61; 6;}// if (tempCurrentAngle > 0) {
//
// tempCurrentAngle &#43;&#61; djDegressBtn / 2;
// }
// else if(tempCurrentAngle <0){
// tempCurrentAngle -&#61; djDegressBtn / 2;
// }
// int btnTypeNum &#61; (int)((tempCurrentAngle &#43; djDegressBtn / 2) / (djDegressBtn));
// btnTypeNum &#61; (int)tempCurrentAngle / (int)djDegressBtn;
//
// float currentSub &#61; tempCurrentAngle - (float)djDegressBtn * btnTypeNum;
// // System.out.println("btnTypeNum" &#43; btnTypeNum);// //btnTypeNum &#61; 6-btnTypeNum;
// System.out.println("btnTypeNum" &#43; btnTypeNum);}public void djTouchEnd(float touchX,float touchY) {calculateDegress();//djChangeImageView();}public void calculateDegress() {double currentAngle &#61; djRotateRelativeLayout.getRotation();double currentSub;currentSub &#61; currentAngle / djDegressBtn;int temp &#61; (int)currentSub;currentSub &#61; currentAngle -djDegressBtn * temp;System.out.println("currentSub &#61; " &#43; currentSub);if (currentSub > 0) {if (currentSub > djDegressBtn / 2) {currentSub &#61; djDegressBtn - currentSub;}else if (currentSub -djDegressBtn / 2) {currentSub &#61; - currentSub;}else if (currentSub <- djDegressBtn / 2) {currentSub &#61; -djDegressBtn - currentSub;}} djSetRotateAnimation(currentSub);}&#64;Overridepublic boolean onTouchEvent(MotionEvent event) {// TODO Auto-generated method stubfloat tempTouchX &#61; event.getX();float tempTouchY &#61; event.getY();PointF pointF &#61; new PointF(tempTouchX, tempTouchY);switch (event.getAction()) {case MotionEvent.ACTION_DOWN:djTouchBegin(pointF);previousPointF &#61; pointF;break;case MotionEvent.ACTION_MOVE:djTouchMove(pointF);previousPointF &#61; pointF;break;case MotionEvent.ACTION_UP:djTouchEnd(tempTouchX, tempTouchY);break;default:break;}return true;}public void djSetRotateAnimation(double angle) {float tempCurrentAngle &#61; djRotateRelativeLayout.getRotation();destinationAngle &#61; tempCurrentAngle &#43; (float)angle;//destinationAngle &#61; tempCurrentAngle &#43; (float)30.0000;System.out.println("tempCurrentAngle" &#43; tempCurrentAngle &#43; "destinationAngle" &#43; destinationAngle );RotateAnimation rotateAnimation &#61; new RotateAnimation((float)0.0,(float)angle,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);rotateAnimation.setAnimationListener(this);rotateAnimation.setDuration(600);rotateAnimation.setFillAfter(true);rotateAnimation.setFillBefore(true);rotateAnimation.setFillEnabled(true);rotateAnimation.setDetachWallpaper(true);djRotateRelativeLayout.startAnimation(rotateAnimation);}// public void getMyComputerCalculate() {
//
// Timer timer &#61; new Timer();
// timer.schedule(new TimerTask() {
//
// &#64;Override
// public void run() {
// // TODO Auto-generated method stub
// calBool &#61; true;
// }
// }, 1);
//
//
// while (true) {
// myComputerCalculate&#43;&#43;;
// if (calBool) {
// break;
// }
// }
//
//
//
// }public void djSetRotate(double degress) {float tempDegress &#61; (float)degress;djRotateRelativeLayout.setRotation(tempDegress);}// public void djRotateTo(double angle,float delay) {
// double rotateTo &#61; angle;
// double currentAngle &#61; djRotateRelativeLayout.getRotation();
// double subAngle &#61; rotateTo - currentAngle ;
// double perAngle &#61; subAngle / (double)myComputerCalculate * delay;
// System.out.println(perAngle);
// for(int i &#61; 0 ; i// {
//
// djRotateRelativeLayout.setRotation( ((float)currentAngle&#43; ((float)perAngle * i)));
// }
//
// djRotateRelativeLayout.setRotation((float)rotateTo);
// }double dj_Degrees_To_Radians(double angle) {return angle * 0.01745329252f; }double dj_Radians_To_Degrees(double angle){return angle * 57.29577951f;}double djDistance(PointF v1,PointF v2){double tempX &#61; v1.x - v2.x;double tempY &#61; v1.y - v2.y; return Math.sqrt(tempX * tempX &#43; tempY * tempY);}PointF djCgpSub(PointF v1,PointF v2){PointF temPointF &#61; new PointF(v1.x - v2.x, v1.y - v2.y);return temPointF;}double djToAngle(PointF vF){return Math.atan2(vF.x, vF.y);}public void adjustAngleByAnimation() {System.out.println("djRotateRelativeLayout.getRotation()" &#43; djRotateRelativeLayout.getRotation());// djRotateRelativeLayout.startAnimation(animation);djRotateRelativeLayout.setRotation(destinationAngle);djRotateRelativeLayout.clearAnimation();//currentImageId &#61; (int)djRotateRelativeLayout.getRotation() / (int)djDegressBtn;if (destinationAngle / 360 <1) {int desNum &#61; (int)destinationAngle / 360;destinationAngle -&#61; 360 * desNum;}currentImageId &#61; (int)destinationAngle / (int)djDegressBtn;if (currentImageId <0) {currentImageId &#43;&#61; 6;if (currentImageId <0) {currentImageId &#43;&#61; 6;}}System.out.println("currentImageId" &#43; currentImageId);System.out.println("currentImageId" &#43; currentImageId);//设置图片djRotateRelativeLayout.changeImageResoures(currentImageId);if (currentImageId !&#61; previousimageId) {djRotateRelativeLayout.changeImageDefaultResources(previousimageId);}previousimageId &#61; currentImageId;//变换图片
//djChangeImageView();}&#64;Overridepublic void onAnimationEnd(Animation animation) {// TODO Auto-generated method stubif (600 &#61;&#61; animation.getDuration()) {adjustAngleByAnimation();}if (650 &#61;&#61; animation.getDuration()) {djRotateRelativeLayout.clearAnimation();}}&#64;Overridepublic void onAnimationRepeat(Animation animation) {// TODO Auto-generated method stub}&#64;Overridepublic void onAnimationStart(Animation animation) {// TODO Auto-generated method stub}&#64;Overridepublic void onClick(View v) {// TODO Auto-generated method stub// switch (v.getId()) {
// case 987654:
// if (calBool) {
// TranslateAnimation translateAnimation &#61; new TranslateAnimation(Animation.RELATIVE_TO_PARENT,0, Animation.RELATIVE_TO_PARENT,0.5f,Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0);
// translateAnimation.setDuration(650);
//
// translateAnimation.setFillAfter(true);
// djRotateRelativeLayout.startAnimation(translateAnimation);
// calBool &#61; false;
//
// }
// else {
// TranslateAnimation translateAnimation &#61; new TranslateAnimation(Animation.RELATIVE_TO_PARENT,0.5f, Animation.RELATIVE_TO_PARENT,0f,Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0);
// translateAnimation.setDuration(650);
//
// translateAnimation.setFillAfter(true);
// djRotateRelativeLayout.startAnimation(translateAnimation);
// calBool &#61; true;
//
//
// }
//
//
//
// break;
//
// default:
// break;
// }}}


一个绝对布局的类 &#xff0c;调整位置

DJRotateAbsoluteView.java

package com.ldci.djrotatemenuforandroid;import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.util.DisplayMetrics;
import android.widget.AbsoluteLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.AbsoluteLayout.LayoutParams;public class DJRotateAbsoluteView extends AbsoluteLayout{public DJRotateAbsoluteView(Context context,int width,int height) {super(context);// TODO Auto-generated constructor stubAbsoluteLayout.LayoutParams djlp &#61; new AbsoluteLayout.LayoutParams(width, height, width/ 2, 0);DJRotateMenuView djRotateMenuView &#61; new DJRotateMenuView(context, width, height);djRotateMenuView.setLayoutParams(djlp);this.addView(djRotateMenuView);}}


DJRotateMenu.java

package com.ldci.djrotatemenuforandroid;import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout;public class DJRotateMenu extends RelativeLayout implements OnClickListener,AnimationListener{private ImageView btnImageView;private boolean calBool &#61; true;private DJRotateAbsoluteView djRotateAbsoluteView;public DJRotateMenu(Context context,int width,int height) {super(context);// TODO Auto-generated constructor stubdjRotateAbsoluteView &#61; new DJRotateAbsoluteView(context, width, height);this.addView(djRotateAbsoluteView);btnImageView &#61; new ImageView(context);btnImageView.setId(987654);btnImageView.setOnClickListener(this);Bitmap btnBitmap &#61; ((BitmapDrawable)getResources().getDrawable(R.drawable.ui_navi_triangle)).getBitmap();RelativeLayout.LayoutParams btnlp &#61; new RelativeLayout.LayoutParams(btnBitmap.getWidth(),btnBitmap.getHeight());btnImageView.setImageBitmap(btnBitmap);btnlp.addRule(RelativeLayout.CENTER_HORIZONTAL);btnlp.addRule(RelativeLayout.CENTER_VERTICAL);btnlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);btnImageView.setLayoutParams(btnlp);this.addView(btnImageView);}&#64;Overridepublic void onClick(View v) {// TODO Auto-generated method stubswitch (v.getId()) {case 987654:if (calBool) {TranslateAnimation translateAnimation &#61; new TranslateAnimation(Animation.RELATIVE_TO_PARENT,0f, Animation.RELATIVE_TO_PARENT,0.5f,Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0);translateAnimation.setDuration(650);// translateAnimation.setAnimationListener(this);translateAnimation.setFillAfter(true);djRotateAbsoluteView.startAnimation(translateAnimation);calBool &#61; false;}else {TranslateAnimation translateAnimation &#61; new TranslateAnimation(Animation.RELATIVE_TO_PARENT,0.5f, Animation.RELATIVE_TO_PARENT,0f,Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 0);translateAnimation.setDuration(650);//translateAnimation.setAnimationListener(this);translateAnimation.setFillAfter(true);djRotateAbsoluteView.startAnimation(translateAnimation);calBool &#61; true;}break;default:break;}}&#64;Overridepublic void onAnimationEnd(Animation animation) {// TODO Auto-generated method stubdjRotateAbsoluteView.clearAnimation();}&#64;Overridepublic void onAnimationRepeat(Animation animation) {// TODO Auto-generated method stub}&#64;Overridepublic void onAnimationStart(Animation animation) {// TODO Auto-generated method stub}}


测试一下我们的程序

MainActivity.java

package com.ldci.djrotatemenuforandroid;import android.os.Bundle;
import android.R.integer;
import android.app.Activity;
import android.graphics.Color;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;public class MainActivity extends Activity {&#64;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);DisplayMetrics dMetrics &#61; new DisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(dMetrics);int width &#61; dMetrics.widthPixels;int height &#61; dMetrics.heightPixels - 125;System.out.println("&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;" &#43; height);//调用时只用这个方法就OKDJRotateMenu djRotateMenu &#61; new DJRotateMenu(this, width, height);setContentView(djRotateMenu);}&#64;Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main, menu);return true;}}


本文完&#xff01;&#xff01;





推荐阅读
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 今日份分享:Flutter自定义之旋转木马
    今日份分享:Flutter自定义之旋转木马-先上图,带你回到童年时光:效果分析子布局按照圆形顺序放置且平分角度子布局旋转、支持手势滑动旋转、快速滑动抬手继续旋转、自动旋转支持X轴旋 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 本文介绍了使用Java实现大数乘法的分治算法,包括输入数据的处理、普通大数乘法的结果和Karatsuba大数乘法的结果。通过改变long类型可以适应不同范围的大数乘法计算。 ... [详细]
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • Android开发实现的计时器功能示例
    本文分享了Android开发实现的计时器功能示例,包括效果图、布局和按钮的使用。通过使用Chronometer控件,可以实现计时器功能。该示例适用于Android平台,供开发者参考。 ... [详细]
  • 带添加按钮的GridView,item的删除事件
    先上图片效果;gridView无数据时显示添加按钮,有数据时,第一格显示添加按钮,后面显示数据:布局文件:addr_manage.xml<?xmlve ... [详细]
  • 今天就跟大家聊聊有关怎么在Android应用中实现一个换肤功能,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根 ... [详细]
  • 本文介绍了lua语言中闭包的特性及其在模式匹配、日期处理、编译和模块化等方面的应用。lua中的闭包是严格遵循词法定界的第一类值,函数可以作为变量自由传递,也可以作为参数传递给其他函数。这些特性使得lua语言具有极大的灵活性,为程序开发带来了便利。 ... [详细]
  • Mac OS 升级到11.2.2 Eclipse打不开了,报错Failed to create the Java Virtual Machine
    本文介绍了在Mac OS升级到11.2.2版本后,使用Eclipse打开时出现报错Failed to create the Java Virtual Machine的问题,并提供了解决方法。 ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • importjava.util.ArrayList;publicclassPageIndex{privateintpageSize;每页要显示的行privateintpageNum ... [详细]
author-avatar
鹏城飞将
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有