Android:时间选择器(最下面有效果图)
1.创建DateUtil类
/*** Created by wangshuai on 2024/11/19.*/
public class DateUtil {public final static String PATTERN_ALL="yyyy-MM-dd HH:mm:ss";public final static String PATTERN_DEFAULT="yyyy-MM-dd";/*** 获取当前时间* @return yyyy-MM-dd*/public static String getNowDate(){Date date=new Date();DateFormat format = new SimpleDateFormat("yyyy-MM-dd");return format.format(date);}/*** 上一个月时间* @param date 时间* @return*/public static String getPreDate(String date){DateFormat df = new SimpleDateFormat("yyyy-MM-dd");String value = "";try {Date now_date = df.parse(date);Calendar g = Calendar.getInstance();g.setTime(now_date);g.add(Calendar.MONTH,-1);Date pre_date = g.getTime();value = df.format(pre_date);} catch (ParseException e) {e.printStackTrace();}return value;}/*** 时间字符串转换格式* @param date 时间* @param oldPattern 当前模式* @param newPattern 转换模式* @return*/public static String formatDate(String date,String oldPattern, String newPattern){DateFormat sdf_old = new SimpleDateFormat(oldPattern);DateFormat sdf_new = new SimpleDateFormat(newPattern);String value = "";try {Date date1 = sdf_old.parse(date);value = sdf_new.format(date1);} catch (Exception e) {e.printStackTrace();}return value;}/*** 时间字符串转换格式* @param date 时间* @param oldPattern 当前模式* @param newPattern 转换模式* @return*/public static Date formatDate(String date, String pattern){DateFormat sdf = new SimpleDateFormat(pattern);Date ret_date =null;try {ret_date = sdf.parse(date);} catch (Exception e) {e.printStackTrace();}return ret_date;}/*** 时间字符串转换格式* @param date 时间* @param pattern 转换模式* @return*/public static String formatDate(Date date, String pattern) {String returnValue = "";if (date != null) {SimpleDateFormat df = new SimpleDateFormat(pattern);returnValue = df.format(date);}return (returnValue);}/*** 判断选择的日期是否是本周* @param time* @return*/public static boolean isThisWeek(String time){Calendar calendar = Calendar.getInstance();int currentWeek = calendar.get(Calendar.WEEK_OF_YEAR);calendar.setTime(new Date(time));int paramWeek = calendar.get(Calendar.WEEK_OF_YEAR);if(paramWeek==currentWeek){return true;}return false;}/*** 字符串转时间* @param date* @return*/public static Date str2Date(String date){SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");try {return sdf.parse(date);} catch (ParseException e) {e.printStackTrace();}return null;}/*** 字符串转时间* @param date* @return*/public static Date str2Date(String date, String pattern){if (StringUtil.isEmpty(date)) {return null;}try {SimpleDateFormat df = new SimpleDateFormat(pattern);return df.parse(date);} catch (Exception e) {e.printStackTrace();return null;}}/*** 判断选择的日期是否是今天* @param date* @return*/public static boolean isToday(String date) {date = date.replaceAll(" ","");SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");String now = sdf.format(new Date());//当前时间if(date.equals(now)){return true;}return false;}/*** 判断选择的日期是否是本月* @param time* @return*/public static boolean isThisMonth(String time) {Date date = str2Date(time);SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");String param = sdf.format(date);//参数时间String now = sdf.format(new Date());//当前时间if(param.equals(now)){return true;}return false;}/*** 增加分钟* @param date* @param addMin* @return*/public static String addMin(Date date,int addMin){String returnValue = "";if(date!=null){try {Calendar calendar = Calendar.getInstance();calendar.setTime(date);calendar.add(Calendar.MINUTE,addMin);Date ret_date = calendar.getTime();returnValue = formatDate(ret_date, "yyyy-MM-dd HH:mm");} catch (Exception e) {// TODO: handle exception}}return returnValue;}/*** 比较两个时间* @param firstDate* @param secDate* @return*/public static boolean isBefore(Date firstDate,Date secDate){return firstDate.before(secDate);}/*** 比较两个时间* @param firstDate* @param secDate* @return*/public static boolean isBefore(String firstDate,String secDate,String pattern){try {SimpleDateFormat sdf = new SimpleDateFormat(pattern);Date tmp_first = sdf.parse(firstDate);Date tmp_sec = sdf.parse(secDate);return tmp_first.before(tmp_sec);} catch (Exception e) {// TODO: handle exception}return false;}/*** 比较两个时间* @param firstDate* @param secDate* @return*/public static boolean isBeforeAequals(String firstDate,String secDate,String pattern){try {if(firstDate.equals(secDate)){return true;}SimpleDateFormat sdf = new SimpleDateFormat(pattern);Date tmp_first = sdf.parse(firstDate);Date tmp_sec = sdf.parse(secDate);return tmp_first.before(tmp_sec);} catch (Exception e) {// TODO: handle exception}return false;}public static int getYear(String date,String pattern){try {Calendar calendar = Calendar.getInstance();calendar.setTime(formatDate(date, pattern));return calendar.get(Calendar.YEAR);} catch (Exception e) {String da="";}return -1;}public static int getMonth(String date,String pattern){try {Calendar calendar = Calendar.getInstance();calendar.setTime(formatDate(date, pattern));return calendar.get(Calendar.MONTH)+1;} catch (Exception e) {// TODO: handle exception}return -1;}public static int getDay(String date,String pattern){try {Calendar calendar = Calendar.getInstance();calendar.setTime(formatDate(date, pattern));return calendar.get(Calendar.DATE);} catch (Exception e) {// TODO: handle exception}return -1;}public static int getDayOfMonth(String date,String pattern){try {Calendar calendar = Calendar.getInstance();calendar.setTime(formatDate(date, pattern));calendar.getActualMaximum(Calendar.DAY_OF_MONTH);return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);} catch (Exception e) {// TODO: handle exception}return -1;}public static int getHour(String date,String pattern){try {Calendar calendar = Calendar.getInstance();calendar.setTime(formatDate(date, pattern));return calendar.get(Calendar.HOUR_OF_DAY);} catch (Exception e) {// TODO: handle exception}return -1;}public static int getMinute(String date,String pattern){try {Calendar calendar = Calendar.getInstance();calendar.setTime(formatDate(date, pattern));return calendar.get(Calendar.MINUTE);} catch (Exception e) {// TODO: handle exception}return -1;} public static int getSecond(String date,String pattern){try {Calendar calendar = Calendar.getInstance();calendar.setTime(formatDate(date, pattern));return calendar.get(Calendar.SECOND);} catch (Exception e) {// TODO: handle exception}return -1;}
}
2.创建DecimalUtil
import java.text.DecimalFormat;
/*** Created by wangshuai on 2024/11/19.*/
public class DecimalUtil {public static String keep2zero_head(String str){try {DecimalFormat df=new DecimalFormat("00");return df.format(Integer.parseInt(str));} catch (Exception e) {// TODO: handle exception}return null;}
}
3.创建PickerView
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.FontMetricsInt;
import android.graphics.Paint.Style;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;/*** 滚动选择器 更多详解见博客http://blog.csdn.net/zhongkejingwang/article/details/38513301* * @author wangshuai* */
public class PickerView extends View
{public static final String TAG = "PickerView";/*** text之间间距和minTextSize之比*/public static final float MARGIN_ALPHA = 2.8f;/*** 自动回滚到中间的速度*/public static final float SPEED = 2;private List<String> mDataList;/*** 选中的位置,这个位置是mDataList的中心位置,一直不变*/private int mCurrentSelected;private Paint mPaint;private float mMaxTextSize = 80;private float mMinTextSize = 40;private float mMaxTextAlpha = 255;private float mMinTextAlpha = 120;private int mColorText = 0x333333;private int mViewHeight;private int mViewWidth;private float mLastDownY;/*** 滑动的距离*/private float mMoveLen = 0;private boolean isInit = false;private onSelectListener mSelectListener;private Timer timer;private MyTimerTask mTask;Handler updateHandler = new Handler(){@Overridepublic void handleMessage(Message msg){if (Math.abs(mMoveLen) < SPEED){mMoveLen = 0;if (mTask != null){mTask.cancel();mTask = null;performSelect();}} else// 这里mMoveLen / Math.abs(mMoveLen)是为了保有mMoveLen的正负号,以实现上滚或下滚mMoveLen = mMoveLen - mMoveLen / Math.abs(mMoveLen) * SPEED;invalidate();}};public PickerView(Context context){super(context);init();}public PickerView(Context context, AttributeSet attrs){super(context, attrs);init();}public void setOnSelectListener(onSelectListener listener){mSelectListener = listener;}private void performSelect(){if (mSelectListener != null)mSelectListener.onSelect(mDataList.get(mCurrentSelected));}public void setData(List<String> datas){mDataList = datas;mCurrentSelected = datas.size() / 2;invalidate();}/*** 选择选中的item的index* * @param selected*/public void setSelected(int selected){mCurrentSelected = selected;int distance = mDataList.size() / 2 - mCurrentSelected;if (distance < 0)for (int i = 0; i < -distance; i++){moveHeadToTail();mCurrentSelected--;}else if (distance > 0)for (int i = 0; i < distance; i++){moveTailToHead();mCurrentSelected++;}invalidate();}/*** 选择选中的内容* * @param mSelectItem*/public void setSelected(String mSelectItem){for (int i = 0; i < mDataList.size(); i++)if (mDataList.get(i).equals(mSelectItem)){setSelected(i);break;}}//获取当前选择public String getSelected(){try {return mDataList.get(mCurrentSelected);} catch (Exception e) {// TODO: handle exception}return null;}private void moveHeadToTail(){String head = mDataList.get(0);mDataList.remove(0);mDataList.add(head);}private void moveTailToHead(){String tail = mDataList.get(mDataList.size() - 1);mDataList.remove(mDataList.size() - 1);mDataList.add(0, tail);}@Overrideprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){super.onMeasure(widthMeasureSpec, heightMeasureSpec);mViewHeight = getMeasuredHeight();mViewWidth = getMeasuredWidth();// 按照View的高度计算字体大小mMaxTextSize = mViewHeight/7f;mMinTextSize = mMaxTextSize / 2.2f;isInit = true;invalidate();}private void init(){timer = new Timer();mDataList = new ArrayList<String>();mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);mPaint.setStyle(Style.FILL);mPaint.setTextAlign(Align.CENTER);mPaint.setColor(mColorText);}@Overrideprotected void onDraw(Canvas canvas){super.onDraw(canvas);// 根据index绘制viewif (isInit)drawData(canvas);}private void drawData(Canvas canvas){// 先绘制选中的text再往上往下绘制其余的textfloat scale = parabola(mViewHeight / 4.0f, mMoveLen);float size = (mMaxTextSize - mMinTextSize) * scale + mMinTextSize;mPaint.setTextSize(size);mPaint.setAlpha((int) ((mMaxTextAlpha - mMinTextAlpha) * scale + mMinTextAlpha));// text居中绘制,注意baseline的计算才能达到居中,y值是text中心坐标float x = (float) (mViewWidth / 2.0);float y = (float) (mViewHeight / 2.0 + mMoveLen);FontMetricsInt fmi = mPaint.getFontMetricsInt();float baseline = (float) (y - (fmi.bottom / 2.0 + fmi.top / 2.0));canvas.drawText(mDataList.get(mCurrentSelected), x, baseline, mPaint);// 绘制上方datafor (int i = 1; (mCurrentSelected - i) >= 0; i++){drawOtherText(canvas, i, -1);}// 绘制下方datafor (int i = 1; (mCurrentSelected + i) < mDataList.size(); i++){drawOtherText(canvas, i, 1);}}/*** @param canvas* @param position* 距离mCurrentSelected的差值* @param type* 1表示向下绘制,-1表示向上绘制*/private void drawOtherText(Canvas canvas, int position, int type){float d = (float) (MARGIN_ALPHA * mMinTextSize * position + type* mMoveLen);float scale = parabola(mViewHeight / 4.0f, d);float size = (mMaxTextSize - mMinTextSize) * scale + mMinTextSize;mPaint.setTextSize(size);mPaint.setAlpha((int) ((mMaxTextAlpha - mMinTextAlpha) * scale + mMinTextAlpha));float y = (float) (mViewHeight / 2.0 + type * d);FontMetricsInt fmi = mPaint.getFontMetricsInt();float baseline = (float) (y - (fmi.bottom / 2.0 + fmi.top / 2.0));canvas.drawText(mDataList.get(mCurrentSelected + type * position),(float) (mViewWidth / 2.0), baseline, mPaint);}/*** 抛物线* * @param zero* 零点坐标* @param x* 偏移量* @return scale*/private float parabola(float zero, float x){float f = (float) (1 - Math.pow(x / zero, 2));return f < 0 ? 0 : f;}@Overridepublic boolean onTouchEvent(MotionEvent event){switch (event.getActionMasked()){case MotionEvent.ACTION_DOWN:doDown(event);break;case MotionEvent.ACTION_MOVE:doMove(event);break;case MotionEvent.ACTION_UP:doUp(event);break;}return true;}private void doDown(MotionEvent event){if (mTask != null){mTask.cancel();mTask = null;}mLastDownY = event.getY();}private void doMove(MotionEvent event){mMoveLen += (event.getY() - mLastDownY);if (mMoveLen > MARGIN_ALPHA * mMinTextSize / 2){// 往下滑超过离开距离moveTailToHead();mMoveLen = mMoveLen - MARGIN_ALPHA * mMinTextSize;} else if (mMoveLen < -MARGIN_ALPHA * mMinTextSize / 2){// 往上滑超过离开距离moveHeadToTail();mMoveLen = mMoveLen + MARGIN_ALPHA * mMinTextSize;}mLastDownY = event.getY();invalidate();}private void doUp(MotionEvent event){// 抬起手后mCurrentSelected的位置由当前位置move到中间选中位置if (Math.abs(mMoveLen) < 0.0001){mMoveLen = 0;return;}if (mTask != null){mTask.cancel();mTask = null;}mTask = new MyTimerTask(updateHandler);timer.schedule(mTask, 0, 10);}class MyTimerTask extends TimerTask{Handler handler;public MyTimerTask(Handler handler){this.handler = handler;}@Overridepublic void run(){handler.sendMessage(handler.obtainMessage());}}public interface onSelectListener{void onSelect(String text);}
}
4.创建StringUtil
/*** Created by wangshuai on 2024/11/19.*/
public class StringUtil {public static boolean isEmpty(Object obj){if(obj != null && !obj.toString().trim().isEmpty()&&!"null".equals(obj.toString())) {return false;}return true;}
}
5.创建布局文件popwin_picker_view
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/llt_all"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="bottom"android:orientation="vertical"><LinearLayout android:layout_width="match_parent"android:layout_height="60dp" android:orientation="horizontal"android:background="#FFFFFF"><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_cancel"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:gravity="center"android:textColor="#333333"android:textSize="16sp"android:text="取消"/><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_confirm"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:gravity="center"android:textColor="#333333"android:textSize="16sp"android:text="确定"/></LinearLayout><View android:layout_width="match_parent"android:layout_height="0.5dp"android:background="#E5E5E5"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:background="#ffffff" android:padding="10dp"android:gravity="center_vertical"android:clickable="true"><com.ybgc.acceptanceofconcealedwork.timerpicker.PickerViewandroid:id="@+id/pvw_year"android:layout_width="0dp"android:layout_height="160dp"android:layout_weight="3" /><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_year"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1" android:gravity="center"android:text="年"android:textColor="#333333"android:textSize="18sp"android:textStyle="bold" /><com.ybgc.acceptanceofconcealedwork.timerpicker.PickerViewandroid:id="@+id/pvw_month"android:layout_width="0dp"android:layout_height="160dp"android:layout_weight="2" /><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_month"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:gravity="center"android:text="月"android:textColor="#333333"android:textSize="18sp"android:textStyle="bold" /><com.ybgc.acceptanceofconcealedwork.timerpicker.PickerViewandroid:id="@+id/pvw_day"android:layout_width="0dp"android:layout_height="160dp"android:layout_weight="2" /><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_day"android:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"android:gravity="center"android:text="日"android:textColor="#333333"android:textSize="18sp"android:textStyle="bold" /><!--时分秒 --><com.ybgc.acceptanceofconcealedwork.timerpicker.PickerViewandroid:id="@+id/pvw_hour"android:layout_width="0dp"android:layout_height="160dp"android:layout_weight="2"/><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_hour"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1"android:text="时"android:textColor="#333333"android:textSize="18sp"android:textStyle="bold" /><com.ybgc.acceptanceofconcealedwork.timerpicker.PickerViewandroid:id="@+id/pvw_minute"android:layout_width="0dp"android:layout_height="160dp" android:layout_weight="2"/><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_minute"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1" android:text="分"android:textColor="#333333"android:textSize="18sp"android:textStyle="bold" /><com.ybgc.acceptanceofconcealedwork.timerpicker.PickerViewandroid:id="@+id/pvw_second"android:layout_width="0dp"android:layout_height="160dp"android:layout_weight="2" /><com.ybgc.acceptanceofconcealedwork.divview.SupperTextViewandroid:id="@+id/tvw_second"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="1" android:text="秒"android:textColor="#333333"android:textSize="18sp"android:textStyle="bold" /></LinearLayout></LinearLayout>
6.创建TimerPickerView
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;import com.ybgc.acceptanceofconcealedwork.R;
import com.ybgc.acceptanceofconcealedwork.timerpicker.PickerView.onSelectListener;import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;/*** 时间选择控件** @author wangshuai*/
public class TimePickerView extends PopupWindow {public final static String DISPLAY_YMD = "yyyy-MM-dd";public final static String DISPLAY_YMDHMS = "yyyy-MM-dd HH:mm:ss";public final static String DISPLAY_YMDHM = "yyyy-MM-dd HH:mm";public final static String DISPLAY_HMS = "HH:mm:ss";public final static String DISPLAY_HM = "HH:mm";private final long ANIMATORDELAY = 200L;private final long CHANGEDELAY = 90L;private Context mContext;private PickerView pvw_year;private PickerView pvw_month;private PickerView pvw_day;private PickerView pvw_hour;private PickerView pvw_minute;private PickerView pvw_second;private TextView tvw_year;private TextView tvw_month;private TextView tvw_day;private TextView tvw_hour;private TextView tvw_minute;private TextView tvw_second;private List<String> year_list;private List<String> month_list;private List<String> day_list;private List<String> hour_list;private List<String> min_list;private List<String> sec_list;private String mode;//显示模式private String startTime = "1970-01-01 00:00:00";private String endTime = "2099-12-31 00:00:00";private String displayTime;//显示时间private String select_year;//年private String select_month;//月private String select_day;//日private String select_hour;//时private String select_minute;//分private String select_second;//秒private boolean isDisplayPastTime;//是否显示过去时间private onTimeSelectListener onTimeSelectListener;public TimePickerView(Context context) {this.mContext = context;this.isDisplayPastTime = true;initView();}private void initView() {View view = LayoutInflater.from(mContext).inflate(R.layout.popwin_picker_view, null);initShowView(view);setWidth(LayoutParams.MATCH_PARENT);setHeight(LayoutParams.MATCH_PARENT);setBackgroundDrawable(new ColorDrawable(0x80000000));setOutsideTouchable(false);setTouchable(true);setContentView(view);}private void initShowView(View view) {mode = DISPLAY_YMDHMS;LinearLayout llt_all = view.findViewById(R.id.llt_all);TextView tvw_cancel = view.findViewById(R.id.tvw_cancel);TextView tvw_confirm = view.findViewById(R.id.tvw_confirm);pvw_year = view.findViewById(R.id.pvw_year);pvw_month = view.findViewById(R.id.pvw_month);pvw_day = view.findViewById(R.id.pvw_day);pvw_hour = view.findViewById(R.id.pvw_hour);pvw_minute = view.findViewById(R.id.pvw_minute);pvw_second = view.findViewById(R.id.pvw_second);tvw_year = view.findViewById(R.id.tvw_year);tvw_month = view.findViewById(R.id.tvw_month);tvw_day = view.findViewById(R.id.tvw_day);tvw_hour = view.findViewById(R.id.tvw_hour);tvw_minute = view.findViewById(R.id.tvw_minute);tvw_second = view.findViewById(R.id.tvw_second);initDisplayMode();//设置显示效果llt_all.setOnClickListener(cancel_onClick);tvw_cancel.setOnClickListener(cancel_onClick);tvw_confirm.setOnClickListener(tvw_confirm_onClick);pvw_year.setOnSelectListener(year_onSelect);pvw_month.setOnSelectListener(month_onSelect);pvw_day.setOnSelectListener(day_onSelect);pvw_hour.setOnSelectListener(hour_onSelect);pvw_minute.setOnSelectListener(min_onSelect);pvw_second.setOnSelectListener(sec_onSelect);}//初始化数据private void initData() {year_list = new ArrayList<String>();month_list = new ArrayList<String>();day_list = new ArrayList<String>();hour_list = new ArrayList<String>();min_list = new ArrayList<String>();sec_list = new ArrayList<String>();initYear();initMonth(false);initDay(false);initHour(false);initMinute(false);initSecond(false);sec_list.addAll(min_list);pvw_year.setData(year_list);pvw_month.setData(month_list);pvw_day.setData(day_list);pvw_hour.setData(hour_list);pvw_minute.setData(min_list);pvw_second.setData(sec_list);}//初始年private void initYear() {int start_year = DateUtil.getYear(startTime, DateUtil.PATTERN_ALL);int end_year = DateUtil.getYear(endTime, DateUtil.PATTERN_ALL);year_list.clear();for (int i = start_year; i <= end_year; i++) {year_list.add(i + "");}}//初始月private void initMonth(boolean isSlide) {int start_month = DateUtil.getMonth(startTime, DateUtil.PATTERN_ALL);int start_year = DateUtil.getYear(startTime, DateUtil.PATTERN_ALL);if (!select_year.equals(DecimalUtil.keep2zero_head(start_year + ""))) {start_month = 1;}month_list.clear();for (int i = start_month; i <= 12; i++) {month_list.add(DecimalUtil.keep2zero_head(i + ""));}if (isSlide) {pvw_month.invalidate();pvw_month.setSelected(0);select_month = pvw_month.getSelected();excuteAnimator(ANIMATORDELAY, pvw_month);pvw_month.postDelayed(new Runnable() {@Overridepublic void run() {initDay(true);}}, CHANGEDELAY);}}//初始日private void initDay(boolean isSlide) {int start_day = DateUtil.getDay(startTime, DateUtil.PATTERN_ALL);int day_of_month = DateUtil.getDayOfMonth(startTime, DateUtil.PATTERN_ALL);int start_year = DateUtil.getYear(startTime, DateUtil.PATTERN_ALL);int start_month = DateUtil.getMonth(startTime, DateUtil.PATTERN_ALL);String select_time = select_year + "-" + select_month;String start_time = start_year + "-" + DecimalUtil.keep2zero_head(start_month + "");//判断当前选择时间是否是开始时间if (!select_time.equals(start_time)) {start_day = 1;}String now_time = select_year + "-" + select_month + "-01 00:00:00";day_of_month = DateUtil.getDayOfMonth(now_time, DateUtil.PATTERN_ALL);day_list.clear();for (int i = start_day; i <= day_of_month; i++) {day_list.add(DecimalUtil.keep2zero_head(i + ""));}//滑动时执行if (isSlide) {pvw_day.invalidate();pvw_day.setSelected(0);select_day = pvw_day.getSelected();excuteAnimator(ANIMATORDELAY, pvw_day);pvw_day.postDelayed(new Runnable() {@Overridepublic void run() {initHour(true);}}, CHANGEDELAY);}}//初始时private void initHour(boolean isSlide) {int start_hour = DateUtil.getHour(startTime, DateUtil.PATTERN_ALL);int start_year = DateUtil.getYear(startTime, DateUtil.PATTERN_ALL);int start_month = DateUtil.getMonth(startTime, DateUtil.PATTERN_ALL);int start_day = DateUtil.getDay(startTime, DateUtil.PATTERN_ALL);String select_time = select_year + "-" + select_month + "-" + select_day;String start_time = start_year + "-" + DecimalUtil.keep2zero_head(start_month + "") + "-"+ DecimalUtil.keep2zero_head(start_day + "");if (!select_time.equals(start_time)) {start_hour = 0;}hour_list.clear();for (int i = start_hour; i < 24; i++) {hour_list.add(DecimalUtil.keep2zero_head(i + ""));}if (isSlide) {pvw_hour.invalidate();pvw_hour.setSelected(0);select_hour = pvw_hour.getSelected();excuteAnimator(ANIMATORDELAY, pvw_hour);pvw_hour.postDelayed(new Runnable() {@Overridepublic void run() {initMinute(true);}}, CHANGEDELAY);}}//初始分private void initMinute(boolean isSlide) {int start_min = DateUtil.getMinute(startTime, DateUtil.PATTERN_ALL);int start_year = DateUtil.getYear(startTime, DateUtil.PATTERN_ALL);int start_month = DateUtil.getMonth(startTime, DateUtil.PATTERN_ALL);int start_day = DateUtil.getDay(startTime, DateUtil.PATTERN_ALL);int start_hour = DateUtil.getHour(startTime, DateUtil.PATTERN_ALL);String select_time = select_year + "-" + select_month + "-" + select_day + " " + select_hour;String start_time = start_year + "-" + DecimalUtil.keep2zero_head(start_month + "") + "-"+ DecimalUtil.keep2zero_head(start_day + "") + " " + DecimalUtil.keep2zero_head(start_hour + "");if (!select_time.equals(start_time)) {start_min = 0;}min_list.clear();for (int i = start_min; i < 60; i++) {min_list.add(DecimalUtil.keep2zero_head(i + ""));}if (isSlide) {pvw_minute.invalidate();pvw_minute.setSelected(0);select_minute = pvw_minute.getSelected();excuteAnimator(ANIMATORDELAY, pvw_minute);pvw_minute.postDelayed(new Runnable() {@Overridepublic void run() {initSecond(true);}}, CHANGEDELAY);}}//初始秒private void initSecond(boolean isSlide) {int start_sec = DateUtil.getSecond(startTime, DateUtil.PATTERN_ALL);int start_year = DateUtil.getYear(startTime, DateUtil.PATTERN_ALL);int start_month = DateUtil.getMonth(startTime, DateUtil.PATTERN_ALL);int start_day = DateUtil.getDay(startTime, DateUtil.PATTERN_ALL);int start_hour = DateUtil.getHour(startTime, DateUtil.PATTERN_ALL);int start_min = DateUtil.getMinute(startTime, DateUtil.PATTERN_ALL);String select_time = select_year + "-" + select_month + "-" + select_day + " " + select_hour + ":" + select_minute;String start_time = start_year + "-" + DecimalUtil.keep2zero_head(start_month + "") + "-"+ DecimalUtil.keep2zero_head(start_day + "") + " " + DecimalUtil.keep2zero_head(start_hour + "") + ":"+ DecimalUtil.keep2zero_head(start_min + "");if (!select_time.equals(start_time)) {start_sec = 0;}sec_list.clear();for (int i = start_sec; i < 60; i++) {sec_list.add(DecimalUtil.keep2zero_head(i + ""));}if (isSlide) {pvw_second.invalidate();pvw_second.setSelected(0);select_second = pvw_second.getSelected();excuteAnimator(ANIMATORDELAY, pvw_second);}}//初始化显示private void initDisplayMode() {pvw_year.setVisibility(View.VISIBLE);pvw_month.setVisibility(View.VISIBLE);pvw_day.setVisibility(View.VISIBLE);pvw_hour.setVisibility(View.VISIBLE);pvw_minute.setVisibility(View.VISIBLE);pvw_second.setVisibility(View.VISIBLE);tvw_year.setVisibility(View.VISIBLE);tvw_month.setVisibility(View.VISIBLE);tvw_day.setVisibility(View.VISIBLE);tvw_hour.setVisibility(View.VISIBLE);tvw_minute.setVisibility(View.VISIBLE);tvw_second.setVisibility(View.VISIBLE);switch (mode) {case DISPLAY_YMD:pvw_hour.setVisibility(View.GONE);pvw_minute.setVisibility(View.GONE);pvw_second.setVisibility(View.GONE);tvw_hour.setVisibility(View.GONE);tvw_minute.setVisibility(View.GONE);tvw_second.setVisibility(View.GONE);break;case DISPLAY_YMDHM:pvw_second.setVisibility(View.GONE);tvw_second.setVisibility(View.GONE);break;case DISPLAY_HMS:pvw_year.setVisibility(View.GONE);pvw_month.setVisibility(View.GONE);pvw_day.setVisibility(View.GONE);tvw_year.setVisibility(View.GONE);tvw_month.setVisibility(View.GONE);tvw_day.setVisibility(View.GONE);break;case DISPLAY_HM:pvw_year.setVisibility(View.GONE);pvw_month.setVisibility(View.GONE);pvw_day.setVisibility(View.GONE);pvw_second.setVisibility(View.GONE);tvw_year.setVisibility(View.GONE);tvw_month.setVisibility(View.GONE);tvw_day.setVisibility(View.GONE);tvw_second.setVisibility(View.GONE);default:break;}}//初始化显示数据private void initPickViewDisplayData() {try {if (StringUtil.isEmpty(displayTime)) {pvw_year.setSelected(0);pvw_month.setSelected(0);pvw_day.setSelected(0);pvw_hour.setSelected(0);pvw_minute.setSelected(0);pvw_second.setSelected(0);select_year = pvw_year.getSelected();select_month = pvw_month.getSelected();select_day = pvw_day.getSelected();select_hour = pvw_hour.getSelected();select_minute = pvw_minute.getSelected();select_second = pvw_second.getSelected();} else {Date date = DateUtil.str2Date(displayTime, mode);Calendar calendar = Calendar.getInstance();calendar.setTime(date);select_year = DateUtil.getYear(startTime, DateUtil.PATTERN_ALL) + "";select_month = DecimalUtil.keep2zero_head(DateUtil.getMonth(startTime, DateUtil.PATTERN_ALL) + "");select_day = DecimalUtil.keep2zero_head(DateUtil.getDay(startTime, DateUtil.PATTERN_ALL) + "");select_hour = DecimalUtil.keep2zero_head(DateUtil.getHour(startTime, DateUtil.PATTERN_ALL) + "");select_minute = DecimalUtil.keep2zero_head(DateUtil.getMinute(startTime, DateUtil.PATTERN_ALL) + "");select_second = DecimalUtil.keep2zero_head(DateUtil.getSecond(startTime, DateUtil.PATTERN_ALL) + "");switch (mode) {case DISPLAY_YMDHMS://yyyy-MM-dd HH:mm:ssselect_year = calendar.get(Calendar.YEAR) + "";select_month = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.MONTH) + 1));select_day = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.DATE)));select_hour = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.HOUR_OF_DAY)));select_minute = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.MINUTE)));select_second = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.SECOND)));initData();pvw_year.setSelected(select_year);pvw_month.setSelected(select_month);pvw_day.setSelected(select_day);pvw_hour.setSelected(select_hour);pvw_minute.setSelected(select_minute);pvw_second.setSelected(select_second);break;case DISPLAY_YMDHM://yyyy-MM-dd HH:mmselect_year = calendar.get(Calendar.YEAR) + "";select_month = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.MONTH) + 1));select_day = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.DATE)));select_hour = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.HOUR_OF_DAY)));select_minute = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.MINUTE)));initData();pvw_year.setSelected(select_year);pvw_month.setSelected(select_month);pvw_day.setSelected(select_day);pvw_hour.setSelected(select_hour);pvw_minute.setSelected(select_minute);break;case DISPLAY_YMD://yyyy-MM-ddselect_year = calendar.get(Calendar.YEAR) + "";select_month = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.MONTH) + 1));select_day = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.DATE)));initData();pvw_year.setSelected(select_year);pvw_month.setSelected(select_month);pvw_day.setSelected(select_day);break;case DISPLAY_HMS://HH:mm:ssselect_hour = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.HOUR_OF_DAY)));select_minute = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.MINUTE)));select_second = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.SECOND)));initData();pvw_hour.setSelected(select_hour);pvw_minute.setSelected(select_minute);pvw_second.setSelected(select_second);break;case DISPLAY_HM://HH:mm:ssselect_hour = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.HOUR_OF_DAY)));select_minute = DecimalUtil.keep2zero_head("" + (calendar.get(Calendar.MINUTE)));initData();pvw_hour.setSelected(select_hour);pvw_minute.setSelected(select_minute);break;default:break;}}} catch (Exception e) {// TODO: handle exception}}//消失private OnClickListener cancel_onClick = new OnClickListener() {@Overridepublic void onClick(View v) {dismiss();}};//确认private OnClickListener tvw_confirm_onClick = new OnClickListener() {@Overridepublic void onClick(View v) {String select_time = "";switch (mode) {case DISPLAY_YMDHMS:select_time = select_year + "-" + select_month + "-" + select_day + " " + select_hour + ":" + select_minute + ":" + select_second;break;case DISPLAY_YMDHM:select_time = select_year + "-" + select_month + "-" + select_day + " " + select_hour + ":" + select_minute;break;case DISPLAY_YMD:select_time = select_year + "-" + select_month + "-" + select_day;break;case DISPLAY_HMS:select_time = select_hour + ":" + select_minute + ":" + select_second;break;case DISPLAY_HM:select_time = select_hour + ":" + select_minute;break;default:break;}if (onTimeSelectListener != null) {onTimeSelectListener.onSelect(select_time);}dismiss();}};//设置显示模式public void setMode(String mode) {this.mode = mode;initDisplayMode();}//显示时间public void showPopWin(View view, String time) {displayTime = time;initPickViewDisplayData();showAtLocation(view, Gravity.BOTTOM, 0, 0);}//显示时间控件public void showPopWin(View view) {displayTime = null;initPickViewDisplayData();showAtLocation(view, Gravity.BOTTOM, 0, 0);}//显示当前时间public void showPopWinPresentTime(View view) {String displayTime = DateUtil.formatDate(new Date(), mode);showPopWin(view, displayTime);}//设置是否显示过去时间public void setIsDisplayPastTime(boolean isDisplayPastTime) {this.isDisplayPastTime = isDisplayPastTime;if (!isDisplayPastTime) {startTime = DateUtil.formatDate(new Date(), DISPLAY_YMDHMS);}}//年选择监听private onSelectListener year_onSelect = new onSelectListener() {@Overridepublic void onSelect(String text) {select_year = text;initMonth(true);}};//月选择监听private onSelectListener month_onSelect = new onSelectListener() {@Overridepublic synchronized void onSelect(String text) {select_month = text;initDay(true);}};//日选择监听private onSelectListener day_onSelect = new onSelectListener() {@Overridepublic void onSelect(String text) {select_day = text;initHour(true);}};//时选择监听private onSelectListener hour_onSelect = new onSelectListener() {@Overridepublic void onSelect(String text) {select_hour = text;initMinute(true);}};//分选择监听private onSelectListener min_onSelect = new onSelectListener() {@Overridepublic void onSelect(String text) {select_minute = text;initSecond(true);}};//秒选择监听private PickerView.onSelectListener sec_onSelect = new onSelectListener() {@Overridepublic void onSelect(String text) {select_second = text;}};//动画private void excuteAnimator(long ANIMATORDELAY, View view) {PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("alpha", 1f, 0f, 1f);PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("scaleX", 1f, 1.3f, 1f);PropertyValuesHolder pvhZ = PropertyValuesHolder.ofFloat("scaleY", 1f, 1.3f, 1f);ObjectAnimator.ofPropertyValuesHolder(view, pvhX, pvhY, pvhZ).setDuration(ANIMATORDELAY).start();}//定义时间选择接口public interface onTimeSelectListener {void onSelect(String time);}public void setOnTimeSelectListener(onTimeSelectListener onTimeSelectListener) {this.onTimeSelectListener = onTimeSelectListener;}
}
7.页面中使用时间选择器(点击事件中调用时间选择器)
/*** 初始化时间选择器*/private TimePickerView timePickerView;//时间选择器private void initTimePickerView(View v) {if (timePickerView != null && !timePickerView.isShowing()) {timePickerView.dismiss();timePickerView = null;}timePickerView = new TimePickerView(ActivityLaunchApplication.this);timePickerView.setMode(TimePickerView.DISPLAY_YMDHM);//timePickerView.setIsDisplayPastTime(false);String time = "";if (StringUtil.isEmpty(time)) {time = DateUtil.formatDate(new Date(), TimePickerView.DISPLAY_YMDHM);}timePickerView.showPopWin(v, time);timePickerView.setOnTimeSelectListener(new TimePickerView.onTimeSelectListener() {@Overridepublic void onSelect(String time) {//所选时间hopeAcceptDate = time;stvYsSj.setText(time);}});}
8.效果图
相关文章:
Android:时间选择器(最下面有效果图)
1.创建DateUtil类 /*** Created by wangshuai on 2024/11/19.*/ public class DateUtil {public final static String PATTERN_ALL"yyyy-MM-dd HH:mm:ss";public final static String PATTERN_DEFAULT"yyyy-MM-dd";/*** 获取当前时间* return yyyy-MM-dd*…...
第十六届蓝桥杯模拟赛(第一期)-c++/c
c/c蓝桥杯模拟赛题解,非常详细 质因数 1、填空题 【问题描述】 如果一个数 p 是个质数,同时又是整数 a 的约数,则 p 称为 a 的一个质因数。 请问 2024 有多少个质因数。 【答案提交】 这是一道结果填空的题,你只需要算出结果后提…...
如何挑选路由器?需要看哪些参数?
挑选路由器时,选择合适的型号和参数对于确保家庭或办公网络的速度、稳定性和覆盖范围至关重要。以下是挑选路由器时需要考虑的关键参数和因素: 1. 无线标准 (Wi-Fi标准) 无线标准是衡量路由器性能的核心指标。不同的无线标准提供不同的速率、范围和技术…...
mysql-备份(二)
前章介绍了MySQL的内部数据结构btree,这章讲述mysql的备份 1:环境 ubuntu22.04 LST mysql5.7.42 or win10 mysql5.7.44 (这里图简单直接windows部署) download:https://downloads.mysql.com/archives/community/ 2:install 1> unzip mysql-5.7.44-w…...
Tailwind CSS 和 UnoCSS简单比较
UnoCSS 和 Tailwind CSS 都是流行的原子化 CSS 框架,但它们在设计理念、性能和使用方式上有一些重要的区别。下面是对它们的详细对比: 1. 概述 Tailwind CSS:Tailwind 是一个原子化的 CSS 框架,提供了大量的预定义类(…...
unity3d————范围检测
目录 知识点一:什么是范围检测 知识点二:如何进行范围检测 问题: Physics.queriesHitTriggers 怎么查看是不是true? QueryTriggerInteraction.UseGlobal 参数意味着是否检测触发器将依据全局设置 Physics.queriesHitTrigge…...
修改this.$confirm的按钮位置、图标、文字及标题
在Vue.js项目中,this.$confirm 通常是基于某些UI库(如Element UI或Ant Design Vue)的对话框确认方法。 以下是基于Element UI的this.$confirm的用法示例。 在此之前,你的项目要已经安装了Element UI,如果没安装话就打…...
SQL MID() 函数详解
SQL MID() 函数详解 SQL 中的 MID() 函数是一个非常有用的字符串处理工具,它允许用户从字符串中提取特定位置的子字符串。这个函数在数据库查询和报告中特别有用,尤其是在需要从较长的文本字段中提取特定信息时。本文将详细介绍 MID() 函数的用法、参数…...
【蓝桥杯备赛】123(前缀和的复杂应用)
5. 前缀和的复杂应用 5.1. 123(4 星) 5.1.1. 题目解析 这道题仍然是求一段区间的和,很容易能够想到前缀和找规律: 1------------------1 号块 1 2----------------2 号块 1 2 3--------------3 号块 1 2 3 4------------4 号…...
MINES
MINES (m)6A (I)dentification Using (N)anopor(E) (S)equencing Tombo(v1.4) 命令在 MINES 之前执行: (仅在 fast5 文件中尚未包含 fastq 时需要) tombo preprocess annotate_raw_with_fastqs --fast5-basedir /fast5_dir/ --fastq-file…...
H.265流媒体播放器EasyPlayer.js H5流媒体播放器关于如何查看手机端的日志信息并保存下来
现今流媒体播放器的发展趋势将更加多元化和个性化。人工智能的应用将深入内容创作、用户体验优化等多个方面,带来前所未有的个性化体验。 EasyPlayer.js H.265流媒体播放器属于一款高效、精炼、稳定且免费的流媒体播放器,可支持多种流媒体协议播放&#…...
uni-app快速入门(十一)--常用JS API(上)
在前面学习了uni-app的布局、组件、路由等知识点以后,还要掌握uni-app的JS API ,也可以理解为基于uni-app的java script。本节介绍uni-app的request请求、文件上传、数据缓存、获取位置、获取系统信息、获取手机的网络状态、拨打电话API。 一、request请求 使用uni…...
Flink任务提交到yarn上slot数量为0的问题
现象:Flink提交到yarn上slot数量为0的问题 解决方法: 参考论坛上的方案,修改flink-conf.yaml文件都不管用 最终解决方法: $FLINK_HOME/lib 路径下有2个非.jar结尾的文件,把这几个文件移走之后,再启就可…...
vue3怎么根据字符串获取组件实例
例子: 我在使用vue2开发的时候,定义了一个方法 handler(strRef){ this.$refs[strRef].innerText hello world }, 我在点击某个按钮的时候,调用了方法handler,传递了一个参数是字符串 condition,然后方法…...
ISUP协议视频平台EasyCVR私有化视频平台新能源汽车充电停车管理方案的创新与实践
在环保意识提升和能源转型的大背景下,新能源汽车作为低碳出行的选择,正在全球迅速推广。但这种快速增长也引发了充电基础设施短缺和停车秩序混乱等挑战,特别是在城市中心和人口密集的居住区,这些问题更加明显。因此,开…...
智领未来: 宏集物联网HMI驱动食品与包装行业迈向智能化新高度
行业现状与挑战 食品与包装行业对设备的自动化、智能化水平要求日益提高,特别是瓶装和灌装生产线需要实现高速、高效的生产。此外,该行业还需遵循严格的卫生标准和安全规范,以保证产品质量符合消费者需求。在提高生产效率的同时,…...
redis-击穿、穿透、雪崩
击穿、穿透、雪崩经常听人说吧? 那他到底是啥呢?无非就是在有缓存层的情况下,对各种绕过缓存层从而直接落到了DB上的情况进行的分类。 概念性的东西大概如下,我是记不住,后期具体使用与规避这些问题才是大事ÿ…...
【Redis】服务器异常重启,导致redis启动失败
redis启动失败日志提示信息:Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename> 错误日志示例图(看最后一句) 错误原因解析 这个错误通常是由于Redis的…...
Springboot+Vue的项目搭建(三)
一、拦截器 拦截器(Interceptor)是一种重要的软件设计模式,它在程序执行过程中能够拦截或截取特定的操作或事件,并在操作发生之前、之后或替代操作本身进行自定义的处理。以下是对拦截器知识点的详细归纳: 拦截器的定…...
【Word】一键批量引用论文上标——将正文字体改为上标格式
【Word】一键批量引用论文上标——将正文字体改为上标格式 写在最前面Word一键批量引用论文上标技巧分享核心思路:Word 替换功能 通配符步骤详解1. 打开 Word 替换功能2. 输入通配符模式3. 设置替换格式为上标4. 批量替换 实际效果展示技巧扩展 🌈你好呀…...
DAY1 网络编程(TCP客户端服务器)
作业: TCP客户端服务器。 server服务器代码: #include <myhead.h> #define IP "192.168.110.52" #define PORT 8886 #define BACKLOG 20 int main(int argc, const char *argv[]) {int oldfdsocket(AF_INET,SOCK_STREAM,0);//IPV4通信…...
如何在Ubuntu当中利用CloudCompare软件进行点云配准拼接?
1.首先需要安装相应的cloudcompare软件,以下有两种方式:第一种直接在ubuntu的软件商店里搜索CloudCompare软件进行install,我这里已经安装完毕。 方式二:可以直接原码安装: github地址: https://github.co…...
AWTK 最新动态:支持鸿蒙系统(HarmonyOS Next)
HarmonyOS是全球第三大移动操作系统,有巨大的市场潜力,在国产替代的背景下,机会多多,AWTK支持HarmonyOS,让AWTK开发者也能享受HarmonyOS生态的红利。 AWTK全称为Toolkit AnyWhere,是ZLG倾心打造的一套基于C…...
vue数据变化但页面不变
记录一下vue中数据变了 但是页面没有变化的几种情况和解决办法 情况一:vue无法检测实例不存在于data中的变量 原因:由于 Vue 会在初始化实例时对data中的数据执行getter/setter转化,所以变量必须在data对象上存在才能让Vue将它转化成响应式…...
Leetcode128. 最长连续序列(HOT100)
链接 第一次错误提交: class Solution { public:int longestConsecutive(vector<int>& nums) {int n nums.size();int res 0;sort(nums.begin(),nums.end());//第一次错误写作:sort(nums,numsn);nums是std::vector<int>类型…...
【阅读笔记】Dense trajectories and motion boundary descriptors for action recognition
论文地址:Dense Trajectories and Motion Boundary Descriptors for Action Recognition | International Journal of Computer Vision 如何用一句话描述这份工作?💡 在多个尺度上,对视频序列中每一帧的密集网格上的特征点采样&a…...
React 远程仓库拉取项目部署,无法部署问题
项目场景: 提示:相关背景: React 远程仓库拉取项目部署,二次开发 问题描述 提示:项目中遇到的问题: React 远程仓库拉取项目部署,正确安装依赖后(开发混乱,造成packg…...
CSS3新特性——字体图标、2D、3D变换、过渡、动画、多列布局
目录 一、Web字体 二、字体图标 三、2D变换 1.位移 (1)浮动 (2)相对定位 (3)绝对定位和固定定位 (4)位移 用位移实现盒子的水平垂直居中 2.缩放 利用缩放调整字体到12px以下ÿ…...
前端反向代理的配置和實現
反向代理是位於客戶端和服務器之間的一個中間層,它代表客戶端向伺服器發起請求,然後將伺服器的回應返回給客戶端。與傳統的正向代理不同,反向代理是由伺服器端配置的,客戶端通常不知道它的存在。在前端開發中,反向代理…...
【K8S系列】Kubernetes Pod节点ImagePullBackOff 状态及解决方案详解【已解决】
在 Kubernetes 中,当某个 Pod 的容器无法从指定的镜像仓库拉取镜像时,Pod 的状态会变为 ImagePullBackOff。这通常是因为指定的镜像不存在、镜像标签错误、认证失败或网络问题等原因。 以下是关于 ImagePullBackOff 的详细分析及解决方案。 1. ImagePull…...
wordpress json 时间/上海关键词排名软件
JavaScript零碎知识点基本概念数据类型操作符变量引用类型对象Object数组ArrayFunction类型基本包装类型BOM浏览器对象模型DOM文档对象模型事件基本概念 js组成 ECMAScriptDOM文档对象模型BOM浏览器对象模型 ECMAScript与JavaScript关系 ECMAScript 是 JavaScript 的规范&…...
wordpress bug模式/武汉seo搜索优化
废话不多说了,直接给大家贴代码了,具体代码如下所示:#安装依赖包yum search libaio # search for infoyum install libaio # install library#新建用户组合用户groupadd mysqluseradd mysql -g mysql#解压到data下面tar -zxvf /data/software…...
网站移动页面怎么做的/seo点击器
当前版本中加入的公会战是公会间的攻城战玩法,以公会为参与单位。每周周二、周六21:00—22:00开启。在游戏主界面点击【公会】,然后点击【领地】页签,选择可进入的防守或进攻战场。【宣战规则】1、领地分为三层&#x…...
东莞电商网站建设/网站建设平台哪家好
也许有的开发者觉得在Android开发中用户界面设计和实现简陋而麻烦,缺乏有效的帮助和支持。Android-ui-utils开源项目包含了一系列工具,帮助我们更好的设计和开发Android用户界面。项目主页为http://code.google.com/p/android-ui-utils/。它主要包含以下…...
网站维护协议/广州百度seo排名优化
这是因为mysql版本低导致的,只有5.5的会有这个问题,5.6不会有这个问题。 可以使用触发器来替代一下: CREATE TABLE example (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,lastUpdate…...
网站制作整个的流程是什么/百度关键词优化查询
前言:编写kettle的应该是一位爱做饭的程序员 kettle 是 java编写 需要jdk环境 kettle 组成 1.勺子(Spoon.bat/spoon.sh)图形化界面 win选择bat linux选择sh 2.锅(Pan.bat/pan.sh)调用Trans 3.厨房(Kitc…...