Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:30:21+00:00 2026-06-06T04:30:21+00:00

I create my own class which extend ScrollView but scroll bar disapear. How Can

  • 0

I create my own class which extend ScrollView but scroll bar disapear. How Can I show scroll bar when I scroll page. This is code my class:

package se.nindev.restaurant.views;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;

public class ScrollViewer extends ScrollView {
    private float mLastX;
    private float mLastY;
    private float mDiffX;
    private float mDiffY;

         public ScrollViewer(Context context) {
          this(context, null);
         }

         public ScrollViewer(Context context, AttributeSet attrs) {
          this(context, attrs, 0);
         }
         public ScrollViewer(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
         }

//       @Override
//       public boolean dispatchTouchEvent(MotionEvent ev){
//           return super.dispatchTouchEvent(ev);
//       } 
         @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
             switch (ev.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    // reset difference values
                    mDiffX = 0;
                    mDiffY = 0;

                    mLastX = ev.getX();
                    mLastY = ev.getY();
                    break;

                case MotionEvent.ACTION_MOVE:
                    final float curX = ev.getX();
                    final float curY = ev.getY();
                    mDiffX += Math.abs(curX - mLastX);
                    mDiffY += Math.abs(curY - mLastY);
                    mLastX = curX;
                    mLastY = curY;

                    // don't intercept event, when user tries to scroll horizontally
                    if (mDiffX > mDiffY) {
                        return false;
                    }
             }
        return super.onInterceptTouchEvent(ev);
        }
}

More over others elements disaper like when I scroll in the middle of page in scrollview has grafic effects in the top end bottom of page, but in the my class I haven’t that effects. How can I add all effects from normal scroll view to my class?

Edit: ok I add scroll bar: android:scrollbars="vertical" but still don’t know how add this grafic effects

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:30:23+00:00Added an answer on June 6, 2026 at 4:30 am
     ScrollView scrollView = new ScrollView(getContext());
     scrollView.setVerticalScrollBarEnabled(true);
     scrollView.setHorizontalScrollBarEnabled(true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can extend the ToolTip and create my own RichToolTip but I don't understand
For this assignment I had to create my own string class. I initially wrote
I want create a DataSet class which is basically a list of samples. But
At the moment I store each option in its own class attribute but this
This is a really strange one. I've created my own CustomTextField class which I
I've created my own MutableInt class, which contains a primitive int and some methods
I have create my own NSOpenGLView class, right now the data that i want
I recently had an idea to create my own String class to make using
So I want to create my own Azure Table class that uses only IronPython
I'm trying to create my own templated List class as a practice excercise. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.