0
votes

I have a vertical scroll bar inside a horizontal one. The vertical scroll bar is only visible when I scroll horizontally all the way to the right. But I want it to be always visible.

How can I do this? Any help? thanks in advance

My xml looks like this

<HorizontalScrollView 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/gridTitle"
    android:layout_marginLeft="30dp"
    android:layout_marginRight="18dp"
    android:layout_marginBottom="5dp"
    android:fadeScrollbars="false" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginBottom="13dp">

        <!-- This Table Layout is header followed by the table itself-->
        <TableLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:stretchColumns="*" >

            <TableRow 
                android:id="@+id/tableHeader"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
            </TableRow>

        </TableLayout>

       <ScrollView 
                android:id="@+id/verticalScroll"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fadeScrollbars="false">

                <TableLayout
                    android:id="@+id/layout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="12dp"
                    android:stretchColumns="*" >
                </TableLayout>

        </ScrollView> 

    </LinearLayout>

</HorizontalScrollView>

EDITED:

The problem is, that the vertical scroll bar is outside of the screen (if I have a lot of table columns), so I can only see it when I scroll through horizontally.But I want it to be always visible.

2
you want scrollbar in scrollview or horizontalscrollview? - deadfish

2 Answers

2
votes

Just remove

android:fadeScrollbars="false"

line or make it true. Read here.

android:fadeScrollbars => Defines whether to fade out scrollbars when they are not in use.

Edit

Try following two lines in your views. I remove line android:fadeScrollbars="false" and add below 2 lines.

android:scrollbarFadeDuration="0"
android:scrollbarDefaultDelayBeforeFade="0"
0
votes

use ScrollView.setScrollbarFadingEnabled(false);