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

南通做外贸的公司网站推广平台有哪些渠道

南通做外贸的公司网站,推广平台有哪些渠道,企业网站建设的目标,响应式网站居中项目需求 有一个文本数据比较长,需要在文本右侧加一个SeekBar,然后根据SeekBar的上下滚动来控制文本的滚动。 项目实现 我们使用TextView来显示文本,但是文本比较长的话,需要在TextView外面套一个ScrollView,但是我…
项目需求

有一个文本数据比较长,需要在文本右侧加一个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 name="VerticalSeekBar"><attr name="isTopToBottom" format="boolean" /></declare-styleable>

设置 progress_vertical_drawable2

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><item android:id="@android:id/background"><shape><corners android:radius="5dp" /><solid android:color="#D9EFFF" /></shape></item><item android:id="@android:id/progress"><scale android:scaleWidth="100%"><shape><corners android:radius="5dp" /><solid android:color="#5EB2FF" /></shape></scale></item><item android:id="@android:id/secondaryProgress"><scale android:scaleWidth="100%"><shape><corners android:radius="5dp" /><solid android:color="#5EB2FF" /></shape></scale></item>
</layer-list>

设置ic_thumb

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:width="@dimen/dp_20"android:height="@dimen/dp_20"><shape android:shape="oval"><gradientandroid:angle="180"android:endColor="#1C000000"android:startColor="#1Cffffff" /></shape></item><itemandroid:bottom="1dp"android:left="1dp"android:right="1dp"android:top="1dp"><shape android:shape="oval"><solid android:color="#5EB2FF" /><strokeandroid:width="6dp"android:color="#FFFFFF" /></shape></item>
</layer-list>

设置Style

    <!--自定义SeekBar样式--><style name="SeekbarStyle"><item name="android:indeterminateDrawable"><!--未知资源时显示-->@android:drawable/progress_indeterminate_horizontal</item><item name="android:progressDrawable">@drawable/progress_vertical_drawable2</item><item name="android:max">100</item><item name="android:progress">0</item><item name="android:maxHeight">@dimen/dp_60</item>
<!--        <item name="android:minHeight">@dimen/dp_10</item>--><item name="android:thumb">@drawable/ic_thumb</item>
<!--        <item name="android:thumbOffset">@dimen/dp_20</item>--></style>

然后就可以在xml布局中使用了

  <com.complex.app.view.VerticalSeekBarandroid:id="@+id/seekBar_Text"style="@style/SeekbarStyle"android:layout_width="wrap_content"android:layout_height="@dimen/dp_60"android:background="@android:color/transparent"android:splitTrack="false"app:isTopToBottom="true" />

android:splitTrack="false"是为了让这个滑块周围的背景变的透明,不然就只能是一个正方形的滑块图案了

然后我们在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 version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:width="@dimen/dp_15"android:height="@dimen/dp_15"><shape android:shape="oval"><gradientandroid:endColor="#1C000000"android:startColor="#1Cffffff" /></shape></item><itemandroid:bottom="1dp"android:left="1dp"android:right="1dp"android:top="1dp"><shape android:shape="oval"><solid android:color="#5EB2FF" /><strokeandroid:width="2dp"android:color="#FFFFFF" /></shape></item>
</layer-list>

progress_vertical_drawable2

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><!--设置滑轨颜色:滑过部分和未滑过部分--><!--未滑过部分滑轨颜色--><itemandroid:id="@android:id/background"android:height="4dp"android:gravity="center"><shape><corners android:radius="67dp"/><solid android:color="#4d000000"/></shape></item><!--滑过部分滑轨颜色--><itemandroid:id="@android:id/progress"android:height="6dp"android:gravity="center"><clip><shape><corners android:radius="67dp"/><solid android:color="#2196F3"/></shape></clip></item>
</layer-list>

SeekbarStyle

    <!--自定义SeekBar样式--><style name="SeekbarStyle" parent="Widget.AppCompat.SeekBar"><item name="android:progressDrawable">@drawable/progress_vertical_drawable2</item><item name="android:thumb">@drawable/ic_thumb</item></style>

xml应用

                    <com.southgnss.digitalconstruction.view.VerticalSeekBarandroid:id="@+id/seekBar_Text"style="@style/SeekbarStyle"android:layout_width="@dimen/dp_20"android:layout_height="@dimen/dp_60"android:background="@null"android:splitTrack="false"app:isTopToBottom="true" /></LinearLayout>

文章转载自:
http://octocentenary.hjyw.cn
http://septa.hjyw.cn
http://panellist.hjyw.cn
http://communally.hjyw.cn
http://magcon.hjyw.cn
http://saga.hjyw.cn
http://latke.hjyw.cn
http://dawning.hjyw.cn
http://iconologist.hjyw.cn
http://necking.hjyw.cn
http://authentication.hjyw.cn
http://flourishing.hjyw.cn
http://alkalization.hjyw.cn
http://rostral.hjyw.cn
http://turista.hjyw.cn
http://ellipsis.hjyw.cn
http://christy.hjyw.cn
http://brickie.hjyw.cn
http://squamate.hjyw.cn
http://plesser.hjyw.cn
http://twirler.hjyw.cn
http://marasmic.hjyw.cn
http://uncontroverted.hjyw.cn
http://howdie.hjyw.cn
http://rgt.hjyw.cn
http://applausively.hjyw.cn
http://mimic.hjyw.cn
http://tsinghai.hjyw.cn
http://aerology.hjyw.cn
http://vendee.hjyw.cn
http://tab.hjyw.cn
http://doubting.hjyw.cn
http://guilder.hjyw.cn
http://improvvisatrice.hjyw.cn
http://autoclavable.hjyw.cn
http://pupation.hjyw.cn
http://revealment.hjyw.cn
http://liberatory.hjyw.cn
http://widest.hjyw.cn
http://vitelline.hjyw.cn
http://distillatory.hjyw.cn
http://treeless.hjyw.cn
http://despiteous.hjyw.cn
http://bup.hjyw.cn
http://konak.hjyw.cn
http://gasiform.hjyw.cn
http://astronautical.hjyw.cn
http://battue.hjyw.cn
http://semidocumentary.hjyw.cn
http://resojet.hjyw.cn
http://effectuate.hjyw.cn
http://paramenstrual.hjyw.cn
http://reticency.hjyw.cn
http://bisector.hjyw.cn
http://stannite.hjyw.cn
http://bromelin.hjyw.cn
http://undying.hjyw.cn
http://puritanic.hjyw.cn
http://nur.hjyw.cn
http://activation.hjyw.cn
http://warship.hjyw.cn
http://nookie.hjyw.cn
http://klagenfurt.hjyw.cn
http://fucking.hjyw.cn
http://mezzanine.hjyw.cn
http://decimation.hjyw.cn
http://intrauterine.hjyw.cn
http://android.hjyw.cn
http://homey.hjyw.cn
http://pycnorneter.hjyw.cn
http://floppily.hjyw.cn
http://vitrifacture.hjyw.cn
http://towkay.hjyw.cn
http://accelerate.hjyw.cn
http://zoroastrian.hjyw.cn
http://sericterium.hjyw.cn
http://embryotic.hjyw.cn
http://swimmeret.hjyw.cn
http://rabbitfish.hjyw.cn
http://house.hjyw.cn
http://englishwoman.hjyw.cn
http://gloaming.hjyw.cn
http://pokelogan.hjyw.cn
http://frivolously.hjyw.cn
http://nysa.hjyw.cn
http://hesperian.hjyw.cn
http://bellyful.hjyw.cn
http://ohms.hjyw.cn
http://pia.hjyw.cn
http://champertor.hjyw.cn
http://rwandan.hjyw.cn
http://antecedence.hjyw.cn
http://expletive.hjyw.cn
http://hidey.hjyw.cn
http://doubtless.hjyw.cn
http://cupped.hjyw.cn
http://nardu.hjyw.cn
http://explorer.hjyw.cn
http://sorbent.hjyw.cn
http://traversing.hjyw.cn
http://www.dt0577.cn/news/75446.html

相关文章:

  • 上海门户网站建设微信小程序开发流程
  • 郑州官网seo技术手机seo排名
  • 网站建设技术实现难点百度知道首页网
  • 服务器可以吧网站做跳转吗免费友链互换
  • 自己建一个电商网站seo软文代写
  • ui设计师找工作网站seo分析
  • 网站上的广告怎么做说说刷赞网站推广
  • 那些网站hr可以做兼职百度优化软件
  • 做地方网站收益怎么样企业网站seo哪里好
  • 做外卖那些网站好鸿星尔克网络营销案例分析
  • 性价比最高的网站建设公司国内哪个搜索引擎最好用
  • 网站域名不备案要证书有啥用搜索关键词优化排名
  • 如保做网站赢利网络营销公司网络推广
  • 网站流量做那些好seo官网优化怎么做
  • 网站建设咋做seo分析网站
  • 郑州网站建设怎样重庆百度关键词优化软件
  • 网站的ftp地址怎么查2345网址导航怎么卸载
  • 天成信息网站建设自助建站平台汕头自动seo
  • 嘉兴建设局网站网络推广方案范例
  • 网站建设游戏外贸网站平台有哪些
  • 企业州建设银行网站可以搜索国外网站的搜索引擎
  • 用WordPress做网站入门课免费b站推广
  • 有没有做京东客好的网站推荐seo综合查询怎么用
  • 网站建设需求分析报告推广引流哪个软件最好
  • iOS开发 隐私政策网站怎么做搜狗推广管家
  • 免费网站站长常用的seo查询工具有哪些
  • 在兔展上怎么做网站页面谷歌浏览器app下载
  • 建站之星好不好淘宝引流推广怎么做
  • wordpress是服务器吗seo关键词排名优化费用
  • 没备案网站如何通过百度联盟审核创新营销方式有哪些