基本上我有一个水平滚动视图,通过监视我正在分页的 onTouch 事件(即:滚动视图(页面)的每个可见部分在滚动时“点击”到下一个,而不仅仅是有一个标准的ScrollView
.see paged scrollviews在 iOS 中)。
现在我想找到一种方法让内部子代继承与滚动视图相同的宽度(设置为"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
。现在有三个图像的宽度和高度与屏幕的宽度相似,但我想做的是将其更改为 3LinearLayout
秒。
每个都LinearLayout
需要继承与滚动视图相同的宽度,以便在应用我的代码时每个都占用一整个“页面”。
我该怎么做?这是我必须使用代码做的事情吗?我需要什么代码?
谢谢你。