Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activity does not scroll when rotating screen

Tags:

android

when I turn the phone and the screen is rotating I cannot see the whole screen anymore. This is ok but I cannot scroll! Do I have to set some flag or property for scrolling? This is part of my xml...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:layout_width="fill_parent" android:layout_height="fill_parent" >
    <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="*">
        ...
    </TableLayout>
    <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" 
        ...
    </TableLayout>
</LinearLayout>

Thanks!

like image 695
Reto Avatar asked Sep 25 '11 08:09

Reto


People also ask

How do I keep my Android screen from rotating?

Tap the Settings icon to open the Settings app. Scroll down and tap Accessibility. Scroll down to Interaction controls and tap Auto-rotate screen to turn it off.


1 Answers

You have to put your complete layout inside a ScrollView in order for it to scroll.

It scrolls if your layout height is more than the screen height, which happens generally in landscape mode.

In your case put the LinearLayout inside a ScrollView, since ScrollView can only have 1 child.

like image 78
Yashwanth Kumar Avatar answered Oct 20 '22 10:10

Yashwanth Kumar