Search code examples
android-studioandroid-layoutscrollview

Scrollview overlaps part of the text


I need help. At work, I was given a task to figure out why ScrollView overlaps part of the text. The layout is multi-layered, and I think the problem lies in this. I'm new to android studio and it's still hard for me to understand the relationships of all objects.

enter image description here

all the XML is here https://docs.google.com/document/d/1PaGIWPn2w6ubZraVpQfq8Rrqo0uCWYOiIbxnCWaIKTQ/edit?usp=sharing

below is a part of the code
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center|left|center_vertical"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/tvMessage"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:padding="2dp"
                    android:textColor="@color/mainBlackColor"
                    android:textSize="24dp"
                    tools:text="Сообщение" />

                <TextView
                    android:id="@+id/tvDetails"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/red"
                    android:lines="3"
                    android:paddingStart="3dp"
                    android:paddingLeft="3dp"
                    android:paddingTop="2dp"
                    android:paddingEnd="3dp"
                    android:paddingRight="3dp"
                    android:paddingBottom="2dp"
                    android:textColor="@color/mainTextColor"
                    android:textSize="18dp"
                    android:visibility="gone"
                    app:autoSizeMaxTextSize="18dp"
                    app:autoSizeMinTextSize="10dp"
                    app:autoSizeStepGranularity="4dp"
                    app:autoSizeTextType="uniform"
                    tools:text="Детали"
                    tools:visibility="visible" />


            </LinearLayout>
        </ScrollView>

       

Solution

  • Add android:scrollbarStyle="outsideOverlay" and padding_horizontal to your scrollView. This should solve your issue.