1. Download our Official Android App: Forums for Android!

Implement Scrollview based on screen size

Discussion in 'Android Development' started by Aayush Kumar, Aug 10, 2017.

  1. Aayush Kumar

    Aayush Kumar Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Jul 31, 2017

    Jul 31, 2017
    4
    0
    5
    Male
    Hi All,

    I am building an android app that involves the use of scroll view and linear layout.I have implemented it and is working fine for all the screen sizes.But the thing is that if the screen size is big enough to accommodate the contents then the scroll view should not be be working.Instead the things should be displayed normally without the scrolling effect.Is there any way to achieve this effect.

    Regards,
    Aayush Kumar
     

    Advertisement

  2. AQSAANUM

    AQSAANUM Member
    Rank:
    None
    Points:
    26
    Posts:
    55
    Joined:
    Jun 1, 2017

    Jun 1, 2017
    55
    13
    26
    You should code in XML file like this,
    Code (Text):
    1. <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    2.      android:layout_width="fill_parent"
    3.      android:layout_height="fill_parent"
    4.      android:fillViewport="true"
    5.      android:scrollbars = "vertical"
    6.      android:scrollbarStyle="insideInset"
    7.     >
    8.     <RelativeLayout
    9.         android:layout_width="fill_parent"
    10.         android:layout_height="fill_parent"
    11.         android:stretchColumns="1"
    12.         >
    13.         <!-- Add here which you want -->
    14.     </RelativeLayout>
    15.  
    16. </ScrollView>
     

Share This Page

Loading...