[英]Horizontal scroll view does not scroll properly
I have a horizontal scroll view that moves horizontally only 100 dp while it should be much wider, not scroll all the content. 我有一个水平滚动视图,水平移动只有100 dp,而它应该更宽,而不是滚动所有内容。 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>
I'm not 100% sure but did you try making your scrollview fill parent? 我不是百分百肯定,但你是否尝试让你的scrollview填充父母? 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. ScrollView需要有一个大小,以便如果布局超出滚动视图的大小,您可以滚动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.