Reputation: 4716
I have a horizontal scroll view that moves horizontally only 100 dp while it should be much wider, not scroll all the content. What can I do?
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:gravity="center_vertical"
android:text="@string/oggi"
android:textSize="12dp" />
<LinearLayout
android:layout_marginLeft="10dp"
android:layout_width="455dp"
android:layout_height="2dp"
android:background="#000000"
android:layout_gravity="center"
android:orientation="horizontal" >
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:gravity="center_vertical"
android:text="@string/domani"
android:textSize="12dp" />
<LinearLayout
android:layout_marginLeft="10dp"
android:layout_width="455dp"
android:layout_height="2dp"
android:background="#000000"
android:layout_gravity="center"
android:orientation="horizontal" >
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:gravity="center_vertical"
android:text="@string/prossime"
android:textSize="12dp" />
<LinearLayout
android:layout_marginLeft="10dp"
android:layout_width="400dp"
android:layout_height="2dp"
android:background="#000000"
android:layout_gravity="center"
android:orientation="horizontal" >
</LinearLayout>
</LinearLayout>
<!-- Slideshow horz gridview single row -->
<com.jess.ui.TwoWayGridView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/dashboard_grid_giorni"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="#E8E8E8"
app:cacheColorHint="#E8E8E8"
app:verticalSpacing="0dp"
app:horizontalSpacing="10dp"
app:scrollDirectionPortrait="horizontal"
app:scrollDirectionLandscape="horizontal"
/>
</LinearLayout>
</HorizontalScrollView>
Upvotes: 0
Views: 1006
Reputation: 1304
I'm not 100% sure but did you try making your scrollview fill parent? If your scrollview and your layout has the same sizes, there's no point in using a scrollview. ScrollView needs to have a size so that if the layout exceed the size of your scrollview, you can scroll.
Upvotes: 2