Question: In one scenario I have created linear layout inside `HorizontalScrollView` And problem is I am not able to disable its scroll bar I'v tried `scrollbarstyle` ; `scrollbarsize`, `setHorizontalScrollbarEnabled` but none of these method worked?

my xml code is :- 

```
<HorizontalScrollView
        android:id="@+id/horizontal_times"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/divider_one"
        android:layout_marginTop="8dp">

        <LinearLayout
            android:id="@+id/layout_times"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal"
            android:padding="16dp" />
    </HorizontalScrollView>`

```

Answer: 
This attribute `android:scrollbars` can be used to remove scrollbars

Use the below code for reference

```
<HorizontalScrollView
    android:id="@+id/horizontal_times"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/divider_one"
    android:layout_marginTop="8dp"
    android:scrollbars="none">

    <LinearLayout
        android:id="@+id/layout_times"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal"
        android:padding="16dp" />
</HorizontalScrollView>

```
```
create a custom java files
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;

public class CustomScrollView extends ScrollView {

    private boolean enableScrolling = true;

    public boolean isEnableScrolling() {
        return enableScrolling;
    }

    public void setEnableScrolling(boolean enableScrolling) {
        this.enableScrolling = enableScrolling;
    }

    public CustomScrollView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public CustomScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomScrollView(Context context) {
        super(context);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {

        if (isEnableScrolling()) {
            return super.onInterceptTouchEvent(ev);
        } else {
            return false;
        }
    }
    @Override
    public boolean onTouchEvent(MotionEvent ev) {
       if (isEnableScrolling()) {
            return super.onTouchEvent(ev);
       } else {
           return false;
       }
}
}
in your xml file update the following
<com.example.demo.CustomScrollView
        android:id="@+id/myScroll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </com.example.demo.CustomScrollView>
in your activity highlight the following
CustomScrollView myScrollView = (CustomScrollView) findViewById(R.id.myScroll);
        myScrollView.setEnableScrolling(false); // disable scrolling
        myScrollView.setEnableScrolling(true); // enable scrolling

```