Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add scrolling to the view when screen orientation is changed to landscape? [closed]

I have an Activity with several TextEdits and in portrait mode everything is displayed perfectly.But when i switch the device to the landscape mode several views didn't displayed (they are cut).Can i in some way automatically add scrolling to the view when the device is switched to the landscape mode?

like image 978
Oleksandr Karaberov Avatar asked Apr 09 '13 08:04

Oleksandr Karaberov


1 Answers

you can try do this, this maybe helpful to you:

add ScrollView to your layout and set this flag android:fillViewport="true" for example:

 <ScrollView
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >

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

        // your layout

    </LinearLayout>
</ScrollView>

Scroll will be enable when in your screen not enough space for items. Then you can scroll screen. So that if screen orientation is changed to landscape you can scroll items, and in portrait everything is displayed perfectly without ability to scroll.

like image 64
Volodymyr Yatsykiv Avatar answered Oct 27 '22 18:10

Volodymyr Yatsykiv