android.widget.ScrollView.setOnTouchListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(240)

本文整理了Java中android.widget.ScrollView.setOnTouchListener()方法的一些代码示例,展示了ScrollView.setOnTouchListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.setOnTouchListener()方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:setOnTouchListener

ScrollView.setOnTouchListener介绍

暂无

代码示例

代码示例来源:origin: lingochamp/FileDownloader

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_hybrid_test);
  uiHandler = new Handler(new Handler.Callback() {
    @Override
    public boolean handleMessage(Message msg) {
      if (msg.what == WHAT_NEED_AUTO_2_BOTTOM) {
        needAuto2Bottom = true;
      }
      return false;
    }
  });
  assignViews();
  scrollView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        uiHandler.removeMessages(WHAT_NEED_AUTO_2_BOTTOM);
        needAuto2Bottom = false;
      }
      if (event.getAction() == MotionEvent.ACTION_UP ||
          event.getAction() == MotionEvent.ACTION_CANCEL) {
        uiHandler.removeMessages(WHAT_NEED_AUTO_2_BOTTOM);
        uiHandler.sendEmptyMessageDelayed(WHAT_NEED_AUTO_2_BOTTOM, 1000);
      }
      return false;
    }
  });
}

代码示例来源:origin: JasonQS/Anti-recall

private void initBottomNavigationBar(ScrollView view) {
  // 底部navigation bar的show hide
  view.setOnTouchListener((v, event) -> {
    NavigationTabBar navigationTabBar = getActivity().findViewById(R.id.ntb);
    switch (event.getAction()) {
      case MotionEvent.ACTION_MOVE:
        if (event.getHistorySize() < 1)
          return false;
        float y = event.getY();
        float historicalY = event.getHistoricalY(event.getHistorySize() - 1);
        if (y > historicalY)
          navigationTabBar.show();
        else
          navigationTabBar.hide();
    }
    return false;
  });
}

代码示例来源:origin: stackoverflow.com

final ScrollView childScroll = (ScrollView)
    view.findViewById(R.id.resourceactivity_sv_classes_detail);
    parentScroll.setOnTouchListener(new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
    //Log.v(TAG,"PARENT TOUCH");
    childScroll.getParent().requestDisallowInterceptTouchEvent
    (false); return false; } }); childScroll.setOnTouchListener(new
    View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
    //Log.v(TAG,"CHILD TOUCH");
    v.getParent().requestDisallowInterceptTouchEvent(true); return
    false; } });

代码示例来源:origin: huangweicai/OkLibDemo

mFloatView.setOnTouchListener(new View.OnTouchListener() {

代码示例来源:origin: WiInputMethod/VE

public void create(Context context) {
    super.create(vertical, context);
    mTextColor = softKeyboard.skinInfoManager.skinData.textcolor_candidate_t9;
    mBackColor = softKeyboard.skinInfoManager.skinData.backcolor_candidate_t9;
    mQKEmojiManager = new QKEmojiManager(softKeyboard);
    standardButtonHeight = 0;
    standardButtonWidth = 0;
    scrollView.setOnTouchListener(scrollOnTouchListener);
//        SharedPreferences sp = SharedPreferenceManager.getDefaultSharedPreferences(context);
  }

代码示例来源:origin: wenzhihao123/Android-loginsmooth-master

scrollView.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: stackoverflow.com

ScrollView sv = (ScrollView) view.findViewById(R.id.svRecord);
 sv.setOnTouchListener(this);
 sv.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
 sv.setFocusable(true);
 sv.setFocusableInTouchMode(true);

代码示例来源:origin: antest1/kcanotify

fleetMenuArrowUp = mView.findViewById(R.id.fleetview_menu_up);
fleetMenuArrowDown = mView.findViewById(R.id.fleetview_menu_down);
fleetMenu.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View view, MotionEvent motionEvent) {

代码示例来源:origin: huzenan/EasyTransition

private void startBackAnim() {
    // forbidden scrolling
    ScrollView sv = (ScrollView) findViewById(R.id.sv);
    sv.setOnTouchListener(new View.OnTouchListener() {
      @Override
      public boolean onTouch(View v, MotionEvent event) {
        return true;
      }
    });

    // start our anim
    ivAdd.animate()
        .setDuration(200)
        .scaleX(0)
        .scaleY(0);

    layoutAbout.animate()
        .setDuration(300)
        .alpha(0)
        .translationY(-30)
        .setListener(new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            // transition exit after our anim
            EasyTransition.exit(DetailActivity.this, 800, new DecelerateInterpolator());
          }
        });
  }
}

代码示例来源:origin: stackoverflow.com

scrollViewRight = (ScrollView) findViewById(R.id.scrollview_right);
scrollViewLeft.setOnTouchListener(this);
scrollViewRight.setOnTouchListener(this);

代码示例来源:origin: antest1/kcanotify

@Override
  public void run() {
    sv.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    scroll_h_total = sv.getMeasuredHeight();
    scroll_h_layout = sv.getHeight();
    sv.setOnTouchListener(new View.OnTouchListener() {
      @Override
      public boolean onTouch(View view, MotionEvent motionEvent) {
        switch (motionEvent.getAction()) {
          case MotionEvent.ACTION_DOWN:
            int y = (int) motionEvent.getY();
            int direction = 1;
            if (y < scroll_h_layout / 2) direction = -1;
            scroll_touch_count = 0;
            autoScrollScheduler = Executors.newSingleThreadScheduledExecutor();
            autoScrollScheduler.scheduleAtFixedRate(auto_scroll(direction), 800, 200, TimeUnit.MILLISECONDS);
            break;
          case MotionEvent.ACTION_UP:
            autoScrollScheduler.shutdown();
            break;
        }
        return false;
      }
    });
  }
});

代码示例来源:origin: techstar-cloud/memorize-en

background.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: antest1/kcanotify

mView.setVisibility(View.GONE);
battleview = mView.findViewById(R.id.battleview);
battleview.setOnTouchListener(mViewTouchListener);
battleview.findViewById(R.id.battle_node_area).setOnTouchListener(infoListViewTouchListener);
itemView = mInflater.inflate(R.layout.view_battleview_items, null);

代码示例来源:origin: adrianchifor/Swiftnotes

scrollView.setOnTouchListener(new OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: developer-shivam/ChanelView

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  appBar = (Toolbar) findViewById(R.id.landingPageAppBar);
  setSupportActionBar(appBar);
  if (getSupportActionBar() != null) {
    getSupportActionBar().setTitle("");
  }
  setUpNavigationDrawer();
  detector = new GestureDetectorCompat(this, this);
  int displayHeight = getWindowManager().getDefaultDisplay().getHeight();
  firstChildHeight = (displayHeight * 60) / 100; //first tile should cover 60% of height
  defaultChildHeight = displayHeight / 6;
  tilesContainer = (LinearLayout) findViewById(R.id.tileContainer);
  mainScrollView = (ScrollView) findViewById(R.id.mainScrollView);
  mainScrollView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      return true;
    }
  });
  addTilesToContainer();
}

代码示例来源:origin: Wilm0r/giggity

tentHeadersScr.addView(tentHeaders);
tentHeadersScr.setVerticalScrollBarEnabled(false);
tentHeadersScr.setOnTouchListener(new OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {

代码示例来源:origin: Calsign/APDE

codeScroller.setOnTouchListener(new View.OnTouchListener() {
  private static final int MAX_CLICK_DURATION = 200;
  private static final int MAX_DISTANCE = 10;

相关文章

ScrollView类方法