Горизонтальный вид прокрутки не прокручивается должным образом
У меня есть горизонтальная прокрутка, которая перемещается по горизонтали только на 100 дп, в то время как она должна быть намного шире, а не прокручивать весь контент. Что я могу сделать?
<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>
1 ответ
Решение
Я не уверен на 100%, но вы пытались сделать свой родитель прокрутки заполнить? Если ваш scrollview и ваш макет имеют одинаковые размеры, нет смысла использовать scrollview. ScrollView должен иметь размер, чтобы, если макет превышал размер вашего прокрутки, вы могли выполнять прокрутку.