1

I have a Fragment with a ScrollView inside a RelativeLayout that used to work without any problem until now that I upgraded the project's targetSdkVersion and compileSdkVersion from, respectively, 22 and 23 to 27 and, according to this change, I upgraded the com.android.support libraries from 23.0.1 to 27.1.1.

Now, while in Android Studio layout design the ScrollView seems to work, when deployed to device it does not scroll anymore.

I already tried the solutions proposed in the many threads about ScrollView not scrolling (using NestedScrollView, etc), to no avail. Here it follows the XML layout:

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true">

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

        <!-- ... Other stuff here ... -->

    </LinearLayout>

</ScrollView>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="90dp"
    android:layout_alignParentBottom="true"
    android:background="@color/white"
    android:paddingTop="10dp">

    <Button
        style="@style/FlatButton"
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:layout_centerVertical="false"
        android:layout_marginLeft="13.5dp"
        android:layout_marginRight="13.5dp"
        android:alpha="1"
        android:background="@drawable/shape_radius"
        android:text="@string/getapp_save"
        android:textColor="#ffffff"
        android:textSize="18sp"
        android:visibility="visible">
    </Button>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/gradient_bottom_white_transparent">
    </RelativeLayout>

</RelativeLayout>

Thanks in advance.

MajCloud
  • 11
  • 1
  • hmmm.. did u try making it a linearlayout for the parent? and then giving the scrolview a layout_weight equal to 1? – letsCode Dec 10 '18 at 21:25
  • Not really - I would like first to try to fix the scroll using the layout as it is now using the RelativeLayout, since the same behaviour is present in other parts of the application and changing them all would require quite an effort. – MajCloud Dec 10 '18 at 21:52
  • if you have that many layouts then youre doing something wrong in the overall design of the app. Sure, apps can have a ton of layouts... but if a lot of the layouts are the same, then use one. and then change the data inside of it based on the info you get from the server.... but hey, just my opinion. :) – letsCode Dec 11 '18 at 15:43

0 Answers0