【发布时间】:2014-04-07 16:33:55
【问题描述】:
我正在做一个 UI 设计,我必须设计一个完全可滚动的视图。在这个视图中,我在底部有一个视图寻呼机和一个固定的页脚,但是当用户在垂直方向滚动内容时,这个页脚也会滚动。现在这里的页脚有很长的描述,但如果不滚动,那是不可见的。在水平方向滚动时,视图寻呼机将工作并且页脚似乎固定在底部。
这是我的代码。
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayoutFooter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="12dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:text="some dummy textl and Prevention"
android:textSize="12dp" />
<ImageView
android:id="@+id/imageviewViewExpander"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="20"
android:src="@drawable/page_circle_arrow_down" />
</LinearLayout>
<TextView
android:id="@+id/textveiw"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="some dummy textsome dummy textsome dummy textsome dummy text\nsome dummy textsome dummy textsome dummy textsome dummy textsome dummy textsome dummy text\nsome dummy textsome dummy textsome dummy textsome dummy textsome dummy text\nsome dummy textsome dummy textsome dummy textsome dummy text" >
</TextView>
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_above="@id/linearLayoutFooter"
android:layout_alignParentTop="true" >
</android.support.v4.view.ViewPager>
</RelativeLayout>
</ScrollView>
这里的问题是我必须让页脚粘在底部,除非用户滚动,甚至视图寻呼机内容不可见。
【问题讨论】:
-
所以您需要将页脚固定在底部,还是滚动视图上的最后一项,提供图像以便更好地说明。
-
如果用户不垂直滚动视图,页脚将保持在底部。一旦他这样做,页脚也会向上移动,但如果他在水平方向滚动,则视图寻呼机将工作以更改内容并且页脚将保持在原位。
-
问题是不向下滚动就看不到页脚?
-
页脚不可见,但下面有一些内容只有在用户滚动视图时才可见。
标签: android android-viewpager scrollview