1

Is it possible to scroll using android emulator when the orientation is in landscape? If yes, then I must be missing out something..please help me...Thanks

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

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

    <TableLayout

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:stretchColumns="|"
        android:layout_marginBottom="25dp">


    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/tableRow1">

                   .....
  </TableRow>

    </TableLayout>
</LinearLayout>
    </ScrollView>
Hoo
  • 1,740
  • 5
  • 30
  • 63
  • yes , it is absolutely possible to scroll in both directions on emulators and devices – EminenT Sep 28 '15 at 09:06
  • **Yes** the scroll should work in emulator, and your code looks OK. In some devices (old) `Scrollview` is not allowed as parent layout, so try to add a `LinearLayout` as parent for your xml. – Rami Sep 28 '15 at 09:07

2 Answers2

2

Yes, it is absolutely possible. You can add: android:fillViewport="true".

If that does not work, then wrap LinearLayout (as a parent) around Scrollview. I hope that works for you.

Please check this for more information:
https://developer.android.com/reference/android/widget/ScrollView.html

SherylHohman
  • 14,460
  • 16
  • 79
  • 88
IntelliJ Amiya
  • 73,189
  • 14
  • 161
  • 193
0

Yes the scroll should work in emulator, and your code looks OK.

In some (old) devices/emulators Scrollview is not allowed as parent layout, so try to add a LinearLayout as parent for your xml.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

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

          <TableLayout
             ....
          </TableLayout>

     </LinearLayout>

   </ScrollView>

</LinearLayout>
Rami
  • 7,769
  • 11
  • 34
  • 66
  • Do you know how to make it scroll verticle? – Hoo Sep 28 '15 at 16:45
  • ScrollView always scroll vertically. – Rami Sep 28 '15 at 16:49
  • If I want to scroll horizontal, does it sounds possible? – Hoo Sep 28 '15 at 16:52
  • 1
    Yes, but you need to use [HorizontalScrollView](http://developer.android.com/reference/android/widget/HorizontalScrollView.html) instead of ScrollView. If you want a Vertical **and** Horizontal scroll see this [question](http://stackoverflow.com/questions/5771455/android-how-to-allow-horizontal-and-vertical-scrolling) – Rami Sep 28 '15 at 16:55
  • Thanks...will give u feedback tomorrow after I try – Hoo Sep 28 '15 at 17:05