当前位置: 首页 > news >正文

有哪些好的做兼职网站有哪些信用体系建设网站维运工作制度

有哪些好的做兼职网站有哪些,信用体系建设网站维运工作制度,代做seo关键词排名,wordpress数据清除缓存项目需求 有一个文本数据比较长#xff0c;需要在文本右侧加一个SeekBar#xff0c;然后根据SeekBar的上下滚动来控制文本的滚动。 项目实现 我们使用TextView来显示文本#xff0c;但是文本比较长的话#xff0c;需要在TextView外面套一个ScrollView#xff0c;但是我…项目需求 有一个文本数据比较长需要在文本右侧加一个SeekBar然后根据SeekBar的上下滚动来控制文本的滚动。 项目实现 我们使用TextView来显示文本但是文本比较长的话需要在TextView外面套一个ScrollView但是我们现在这个文本是上下滚动的很巧不巧的是我们的文本在一个上下滚动的Recyclerview的item里面这下就很搞了因为两个都是上下滚动的我们需要做一个处理。 首先自定义一个ScrollView public class NonScrollableScrollView extends ScrollView {public NonScrollableScrollView(Context context) {super(context);}public NonScrollableScrollView(Context context, AttributeSet attrs) {super(context, attrs);}public NonScrollableScrollView(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);}Overridepublic boolean onTouchEvent(MotionEvent ev) {return false;}Overridepublic boolean onInterceptTouchEvent(MotionEvent ev) {return false;} } 重写其触摸事件方法使其不响应触摸事件。所有这样的话我们的TextView就不能通过自己滚动了然后我们通过这个SeekBar来控制TextView的滚动 接下来是对SeekBar的修改以下部分内容来自知乎 https://zhuanlan.zhihu.com/p/622534050 SuppressLint(AppCompatCustomView) public class VerticalSeekBar extends SeekBar {private boolean isTopToBottom false;//显示进度方向是否从上到下默认false从下到上public VerticalSeekBar(Context context) {super(context);}public VerticalSeekBar(Context context, AttributeSet attrs) {super(context, attrs);TypedArray ta context.getTheme().obtainStyledAttributes(attrs, R.styleable.VerticalSeekBar, 0, 0);try {isTopToBottom ta.getBoolean(R.styleable.VerticalSeekBar_isTopToBottom, false);} finally {ta.recycle();}}public VerticalSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);}public void setOnSeekBarChangeListener(OnSeekBarChangeListener l) {mOnSeekBarChangeListener l;}void onStartTrackingTouch() {if (mOnSeekBarChangeListener ! null) {mOnSeekBarChangeListener.onStartTrackingTouch(this);}}void onStopTrackingTouch() {if (mOnSeekBarChangeListener ! null) {mOnSeekBarChangeListener.onStopTrackingTouch(this);}}protected void onSizeChanged(int w, int h, int oldw, int oldh) {super.onSizeChanged(h, w, oldh, oldw);}Overridepublic synchronized void setProgress(int progress) {super.setProgress(progress);onSizeChanged(getWidth(), getHeight(), 0, 0);}Overrideprotected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {super.onMeasure(heightMeasureSpec, widthMeasureSpec);setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());}protected void onDraw(Canvas c) {if (isTopToBottom) {//显示进度方向 从上到下c.rotate(90);c.translate(0, -getWidth());} else {//显示进度方向 从下到上c.rotate(-90);c.translate(-getHeight(), 0);}super.onDraw(c);}Overridepublic boolean onTouchEvent(MotionEvent event) {if (!isEnabled()) {return false;}switch (event.getAction()) {case MotionEvent.ACTION_DOWN:onStartTrackingTouch();trackTouchEvent(event);break;case MotionEvent.ACTION_MOVE:trackTouchEvent(event);attemptClaimDrag();break;case MotionEvent.ACTION_UP:trackTouchEvent(event);onStopTrackingTouch();break;case MotionEvent.ACTION_CANCEL:onStopTrackingTouch();break;}return true; // getParent().requestDisallowInterceptTouchEvent(true); // return super.onTouchEvent(event);}private void trackTouchEvent(MotionEvent event) {//关键更改2int progress getMax() - (int) (getMax() * event.getY() / getHeight());//触摸进度方向 从下到上if (isTopToBottom) {progress (int) (getMax() * event.getY() / getHeight());//触摸进度方向 从上到下}setProgress(progress);if (mOnSeekBarChangeListener ! null) {mOnSeekBarChangeListener.onProgressChanged(this, progress);}}private void attemptClaimDrag() {if (getParent() ! null) {getParent().requestDisallowInterceptTouchEvent(true);}}public boolean dispatchKeyEvent(KeyEvent event) {if (event.getAction() KeyEvent.ACTION_DOWN) {KeyEvent newEvent null;switch (event.getKeyCode()) {case KeyEvent.KEYCODE_DPAD_UP:newEvent new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_RIGHT);break;case KeyEvent.KEYCODE_DPAD_DOWN:newEvent new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_LEFT);break;case KeyEvent.KEYCODE_DPAD_LEFT:newEvent new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_DOWN);break;case KeyEvent.KEYCODE_DPAD_RIGHT:newEvent new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DPAD_UP);break;default:newEvent new KeyEvent(KeyEvent.ACTION_DOWN,event.getKeyCode());break;}KeyEvent.DispatcherState dispatcherState new KeyEvent.DispatcherState();dispatcherState.isTracking(event);return newEvent.dispatch(this, dispatcherState, event);}return false;}/*** 设置显示进度方向** param isTopToBottom true 方向从上到下*/public void setTopToBottom(boolean isTopToBottom) {this.isTopToBottom isTopToBottom;}private OnSeekBarChangeListener mOnSeekBarChangeListener;public interface OnSeekBarChangeListener {void onProgressChanged(VerticalSeekBar VerticalSeekBar, int progress);void onStartTrackingTouch(VerticalSeekBar VerticalSeekBar);void onStopTrackingTouch(VerticalSeekBar VerticalSeekBar);} } 需要在attrs文件里面添加 (需要注意因为在知乎上面没有这个东西) declare-styleable nameVerticalSeekBarattr nameisTopToBottom formatboolean //declare-styleable设置 progress_vertical_drawable2 ?xml version1.0 encodingutf-8? layer-list xmlns:androidhttp://schemas.android.com/apk/res/androiditem android:idandroid:id/backgroundshapecorners android:radius5dp /solid android:color#D9EFFF //shape/itemitem android:idandroid:id/progressscale android:scaleWidth100%shapecorners android:radius5dp /solid android:color#5EB2FF //shape/scale/itemitem android:idandroid:id/secondaryProgressscale android:scaleWidth100%shapecorners android:radius5dp /solid android:color#5EB2FF //shape/scale/item /layer-list设置ic_thumb ?xml version1.0 encodingutf-8? layer-list xmlns:androidhttp://schemas.android.com/apk/res/androiditemandroid:widthdimen/dp_20android:heightdimen/dp_20shape android:shapeovalgradientandroid:angle180android:endColor#1C000000android:startColor#1Cffffff //shape/itemitemandroid:bottom1dpandroid:left1dpandroid:right1dpandroid:top1dpshape android:shapeovalsolid android:color#5EB2FF /strokeandroid:width6dpandroid:color#FFFFFF //shape/item /layer-list设置Style !--自定义SeekBar样式--style nameSeekbarStyleitem nameandroid:indeterminateDrawable!--未知资源时显示--android:drawable/progress_indeterminate_horizontal/itemitem nameandroid:progressDrawabledrawable/progress_vertical_drawable2/itemitem nameandroid:max100/itemitem nameandroid:progress0/itemitem nameandroid:maxHeightdimen/dp_60/item !-- item nameandroid:minHeightdimen/dp_10/item--item nameandroid:thumbdrawable/ic_thumb/item !-- item nameandroid:thumbOffsetdimen/dp_20/item--/style然后就可以在xml布局中使用了 com.complex.app.view.VerticalSeekBarandroid:idid/seekBar_Textstylestyle/SeekbarStyleandroid:layout_widthwrap_contentandroid:layout_heightdimen/dp_60android:backgroundandroid:color/transparentandroid:splitTrackfalseapp:isTopToBottomtrue /android:splitTrackfalse是为了让这个滑块周围的背景变的透明不然就只能是一个正方形的滑块图案了 然后我们在RecyclerView的Adapter里面进行设置 protected void convert(BaseViewHolder helper, ElectronicFencePoint item) {NonScrollableScrollView scrollView helper.getView(R.id.ns_scroll);VerticalSeekBar seekBar helper.getView(R.id.seekBar_Text);scrollView.post(() - {int maxScroll scrollView.getChildAt(0).getHeight() - scrollView.getHeight();if (maxScroll 0) {//这里我的逻辑是当TextView的文本显示内容不多不需要滑动的时候设置滑块滑动到底部显示seekBar.setProgress(seekBar.getMax());} else {//当TextView的文本很多需要滑动的时候将滑块放在顶部seekBar.setProgress(0);seekBar.setMax(maxScroll);}});seekBar.setOnSeekBarChangeListener(new VerticalSeekBar.OnSeekBarChangeListener() {Overridepublic void onProgressChanged(VerticalSeekBar VerticalSeekBar, int progress) {scrollView.scrollTo(0, progress);}Overridepublic void onStartTrackingTouch(VerticalSeekBar VerticalSeekBar) {}Overridepublic void onStopTrackingTouch(VerticalSeekBar VerticalSeekBar) {}});scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {Overridepublic void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {seekBar.setProgress(scrollY);}}); }补充 开始滑动前 开始滑动后 这个只需要修改一下样式就好了 ic_thumb ?xml version1.0 encodingutf-8? layer-list xmlns:androidhttp://schemas.android.com/apk/res/androiditemandroid:widthdimen/dp_15android:heightdimen/dp_15shape android:shapeovalgradientandroid:endColor#1C000000android:startColor#1Cffffff //shape/itemitemandroid:bottom1dpandroid:left1dpandroid:right1dpandroid:top1dpshape android:shapeovalsolid android:color#5EB2FF /strokeandroid:width2dpandroid:color#FFFFFF //shape/item /layer-listprogress_vertical_drawable2 ?xml version1.0 encodingutf-8? layer-list xmlns:androidhttp://schemas.android.com/apk/res/android!--设置滑轨颜色滑过部分和未滑过部分--!--未滑过部分滑轨颜色--itemandroid:idandroid:id/backgroundandroid:height4dpandroid:gravitycentershapecorners android:radius67dp/solid android:color#4d000000//shape/item!--滑过部分滑轨颜色--itemandroid:idandroid:id/progressandroid:height6dpandroid:gravitycenterclipshapecorners android:radius67dp/solid android:color#2196F3//shape/clip/item /layer-listSeekbarStyle !--自定义SeekBar样式--style nameSeekbarStyle parentWidget.AppCompat.SeekBaritem nameandroid:progressDrawabledrawable/progress_vertical_drawable2/itemitem nameandroid:thumbdrawable/ic_thumb/item/stylexml应用 com.southgnss.digitalconstruction.view.VerticalSeekBarandroid:idid/seekBar_Textstylestyle/SeekbarStyleandroid:layout_widthdimen/dp_20android:layout_heightdimen/dp_60android:backgroundnullandroid:splitTrackfalseapp:isTopToBottomtrue //LinearLayout
http://www.hkea.cn/news/14341040/

相关文章:

  • 外贸网站模板制作网站系统升级需要多久
  • 徐州百度搜索网站排名公司网站模板大全
  • 李沧网站建设wordpress 去除评论框
  • 大型网站开发文档成都网站seo设计
  • 做网站的ui安嶶省城乡建设网站
  • 中国建设银行什么是网站用户名江门东莞网络推广
  • 域名如何绑定网站专注网站建设
  • 中企动力做网站要全款易语言做网站简单教程
  • 商业网站有哪些怎么套用模板做网站
  • 商城系统网站模板简述网站的建设流程图
  • 公司行政负责做网站吗自适应网站举例
  • 网站页面设计策划书设计logo网站免费南蒲四特
  • 新昌县城乡建设局网站seo课程哪个好
  • 北京网站建设公司网络营销外包网络建站报价外链网站分类
  • 建设网站的一般步骤是郑州网站设计费用
  • 网站颜色搭配乔拓云智能建站官网登录入口
  • 园林景观设计案例网站商城网站开发企业
  • 网站优化建设深圳沧州网站建设网海申
  • 网站合同建设模板温州网站制作公司
  • 织里网站建设自己做网站 需要哪些
  • 淄博 网站运营php招聘网站建设
  • 郑州正规的网站设计国家级示范校建设网站
  • 局门户网站的建设一个公司网站备案吗
  • 学历网站怎么做一键生成app下载
  • 入群修改网站后台wordpress文件上传管理
  • wordpress菜单侧边栏福州seo管理
  • 网站建设全流程做内容的网站
  • 网站建设公司好wordpress 高亮插件
  • 菏泽网站建设公司官网logo是什么伊思logo
  • 商务网站开发考卷昆明做网站公司