Search code examples
androidsizewidthscrollviewhorizontalscrollview

HorizontalScrollView android Doesnt work very well


Good morning everybody

I have a problem with an HorizontalScrollView.

I see all the textview in a horizontal linearlayout but at the end happend a problem.

The horizontalScrollView is unable to display all the information, there is like a cut of the view...why?

is there a maximun size of the horizontalScrollView maybe?

a part of code xml

<ScrollView 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true">
        <HorizontalScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:scrollbars="none"
            android:id="@+id/hrz_scroll"
            android:layout_weight="1"
        >
        <!--  Header  Starts-->
            <LinearLayout 
            android:id="@+id/MostraRigheInserzioneActivity_layout_linearLayout"
            android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
            android:background="@layout/header_gradient" 
            android:paddingTop="5dip"
        android:paddingBottom="5dip">    
        </LinearLayout>
    </HorizontalScrollView>
</ScrollView>

print screen

enter image description here

help me best regards


Solution

  • Try like this for your concern

      <HorizontalScrollView 
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:scrollbars="none"
             android:id="@+id/hrz_scroll"
             android:layout_weight="1"
             >
    

    Try this:

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:fillViewport="true" >
    
            <HorizontalScrollView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:scrollbars="none"
                android:id="@+id/hrz_scroll"
                android:layout_weight="1"
            >
            <!--  Header  Starts-->
                <LinearLayout 
                android:id="@+id/MostraRigheInserzioneActivity_layout_linearLayout"
                android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
                android:background="@layout/header_gradient" 
                android:paddingTop="5dip"
            android:paddingBottom="5dip">    
            </LinearLayout>
        </HorizontalScrollView>
    </ScrollView>