Hoo
Hoo

Reputation: 1840

Cannot scroll in android emulator

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>

Upvotes: 2

Views: 9079

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

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

Upvotes: 2

Rami
Rami

Reputation: 7929

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>

Upvotes: 0

Related Questions