【发布时间】:2016-07-27 15:10:49
【问题描述】:
我创建了一个滚动视图,它应该允许我滚动浏览线性布局内的所有内容(即滚动视图的子视图)。
代码如下:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="pl.oakfusion.delegator.DomesticDelegationSecondFragment">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
....
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp"
android:background="@color/textDarkest"
android:text="Save"
android:textColor="@color/textColor"
android:layout_gravity="right" />
</LinearLayout>
预览看起来像这样:
但在我的应用中我有这个:
我无法向下滚动,我只能看到这些。
如果我允许旋转,我有水平视图:
现在允许我滚动但完全切断按钮。 (在图片上是视图的底部)我可以快速下拉,我可以看到按钮在那里但它又上升了(这个 android 的东西当你可以稍微拉远但它会向后滚动)
我该如何解决这个问题?
托管活动:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="pl.oakfusion.delegator.DomesticDelegationActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
【问题讨论】:
-
您的活动布局如何(xml)?您是否使用像这里 stackoverflow.com/questions/31709100/… 这样的 CoordinatorLayout ?
-
请分享您的完整 xml,并托管布局(如果有)以纠正问题。
-
对,更新帖子
标签: android android-fragments android-scrollview