0

Hlo viewers , I am building an app in which i am using codeview, so for viewing all codeview i placed a horizontall scroll view for codeview , it is working fine but horizontal scroll view is keep scrolling , by which it impact over the optimization , However i can fix the HorizontalScrollView width so that the code scroll till its end only. Thanks

here is code :

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">

    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <br.tiagohm.codeview.CodeView
            android:id="@+id/code_view"
            android:layout_width="700dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="7dp"
            android:scrollbars="horizontal"
            app:cv_font_size="12"
            app:cv_show_line_number="true"
            app:cv_start_line_number="1"
            app:cv_wrap_line="true"
            app:cv_zoom_enable="true">

        </br.tiagohm.codeview.CodeView>
    </HorizontalScrollView>


</ScrollView>
Amit Swami
  • 23
  • 4

1 Answers1

0

I have found solution , for custom width of horizintalscrollview in fragment we have to do like this:

<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <br.tiagohm.codeview.CodeView
            android:id="@+id/code_view"
            android:layout_width="1000dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="7dp"
            app:cv_font_size="12"
            app:cv_show_line_number="true"
            app:cv_start_line_number="1"
            app:cv_wrap_line="true"
            app:cv_zoom_enable="true">

        </br.tiagohm.codeview.CodeView>
    </LinearLayout>

</HorizontalScrollView>
Amit Swami
  • 23
  • 4