我想scroll
在android的背景。我有一个scrollview
有很多观点的。我需要实现一种在添加视图时只需要滚动背景的方法。我遇到了很多论坛,但没有一个很清楚。请给出一个想法或参考来实现它。为了更好地了解我正在寻找的东西,只需考虑一个自行车游戏,其中背景道路图像在骑自行车时移动。滚动屏幕时我只需要类似的实现。
问问题
727 次
1 回答
1
也许你可以这样做:
RelativeLayout
作为家长ScrollView
将您的图像设置为背景
- 然后是其他视图,但在 的外部
ScrollView
和内部RelativeLayout
。
编辑:
<RelativeLayout
android:id="@+id/relParent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<OtherViews />
<ScrollView
android:id="@+id/scrlParent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/yourbackground">
</ScrollView>
</RelativeLayout>
我认为这样的事情可能会奏效。你看,RelativeLayout
是父母。然后是您的其他视图,位于您的ScrollView
. 然后,在您的其他视图标记之后,出现ScrollView
,只有一个背景。我不确定背景标签是否有效,所以也许你应该删除android:background="@drawable/yourbackground"
并ImageView
在ScrollView
.
于 2012-07-05T17:31:26.060 回答