0

i'm building an tutorial app where im displaying code snippet to user, but scrolling is just working on white area of the screen but not over the code snippet, may be codeview is overlapping the scrollview, How to resolve it so the codeview also scroll:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="activity_main.xml"
            android:textColor="@android:color/black"
            android:textStyle="bold"
            android:layout_marginTop="5dp"
            android:textSize="18sp"/>

        <io.github.kbiakov.codeview.CodeView
            android:id="@+id/code_view_xml"
            android:layout_marginTop="7dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="create layout resource file inside layout directory with name:"
            android:layout_marginTop="10dp"
            android:textColor="#000000"
            android:textStyle="italic"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="single_item.xml"
            android:textColor="@android:color/black"
            android:textStyle="bold"
            android:layout_marginTop="5dp"
            android:textSize="18sp"/>

        <io.github.kbiakov.codeview.CodeView
            android:id="@+id/code_view_item"
            android:layout_marginTop="7dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>


    </LinearLayout>

</ScrollView>

here the output :

screenshot

hata
  • 11,633
  • 6
  • 46
  • 69
Amit Swami
  • 23
  • 4
  • Possibly related: [github repo: kbiakov/CodeView-Android - CodeView inside NestedScrollView scroll issue](https://github.com/kbiakov/CodeView-Android/issues/45) – Morrison Chang Nov 08 '21 at 06:07

1 Answers1

0

You are missing padding. Try adding padding. Also your linearlayout height is match_parent. Change that to wrap and then try