0

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.

Tünde
  • 885
  • 4
  • 11
  • 24

2 Answers2

2

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"
Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
  • @Tünde, I edit my answer. Please check it. I tried in my GridView. It works fine for me. – Chintan Rathod Jun 18 '13 at 07:45
  • And you can also scroll horizontally in the table view? – Tünde Jun 18 '13 at 07:57
  • 1
    I am not having problem with the fade property of my scroll bar. My problem is that it is outside of the screen (if I have a lot of table columns), so I can only see it when I scroll through horizontally. (sorry if I do not explain my self correctly...) – Tünde Jun 18 '13 at 08:01
  • I haven't implemented on your layout. I gave answer on basis of "Always Scrollbars Visible". Official android site don't advice to use any `Scrollable View` inside another `Scrollable View`. – Chintan Rathod Jun 18 '13 at 08:01
  • Ok, than do you have any idea how should I implement this functionality in other way? I really need my table to be scrollable horizontally and vertically, too, and this is the approach that I found. – Tünde Jun 18 '13 at 08:04
  • may this answer help you. http://stackoverflow.com/questions/5771455/android-how-to-allow-horizontal-and-vertical-scrolling – Chintan Rathod Jun 18 '13 at 08:06
  • Sorry, I a beginner, and don't see this solution is working for me. There you can scroll only horizontally. – Tünde Jun 18 '13 at 08:17
  • hi Tünde i am facing same problem. will you guide me how to resolve it. – chet's Nov 05 '14 at 05:37
  • Inside my horizontal scrollview, horizontal scroll bar showing but vertical scroll bar not showing. – chet's Nov 05 '14 at 05:52
  • @chet's my friend, horizontal scroll view will not show vertical scroll bar. The name specifically said it is horizontal .. – Chintan Rathod Nov 05 '14 at 05:53
0

use ScrollView.setScrollbarFadingEnabled(false);

abhi
  • 759
  • 6
  • 15