基本上我有一个水平滚动视图,通过监视onTouch事件我正在分页(即:滚动视图(页面)的每个可见部分“点击”滚动到下一个,而不仅仅是具有标准的ScrollView
。请参阅iOS中的分页滚动视图)。horizontalscrollview设置子元素来填充horizontalscrollview的宽度
现在我想找到一种方法来让内部子代继承与滚动视图相同的宽度(设置为"fill_parent"
)。
这里是我的XML的帮助:
<HorizontalScrollView
android:id="@+id/scrollview"
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="1"
android:background="@drawable/scrollviewbg">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageView
android:src="@drawable/content1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/content2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/content3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</HorizontalScrollView>
正如你可以看到滚动视图设置为宽度fill_parent
并且里面有它LinearLayout
。现在有三个图像的宽度和高度与屏幕宽度相似,但我想要做的是更改为3 LinearLayout
s。
每个LinearLayout
都需要继承与滚动视图相同的宽度,这样当我的代码被应用时,每个代码都会占用整个“页面”。
我该怎么做?这是我将不得不使用代码吗?我需要什么代码?
谢谢。
是容易得多。感谢那。 :) –
我没有该选项使用支持库,我们可以在scrollview中执行 – user606669