工具栏下方的Android ScrollView无法显示所有内容
我制作了一个带有工具栏的基本活动,并将我的布局添加到其中。但是,当我在主内容中添加一个scrollview时,向下滚动时,它不会显示底部部分。缺少的部分似乎与工具栏的高度相同 My activitybase.xml:工具栏下方的Android ScrollView无法显示所有内容,android,scrollview,toolbar,Android,Scrollview,Toolbar,我制作了一个带有工具栏的基本活动,并将我的布局添加到其中。但是,当我在主内容中添加一个scrollview时,向下滚动时,它不会显示底部部分。缺少的部分似乎与工具栏的高度相同 My activitybase.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ToolBarStyle"
android:background="?attr/colorPrimary" />
<FrameLayout
android:id="@+id/root_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
My fragmentinfo.xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/default_margin">
<TextView
android:id="@+id/info_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:text="hei"
style="@style/TextLarge" />
<TextView
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_margin"
android:text="-SOME LONG TEXT-"
style="@style/TextNormal" />
<TextView
android:id="@+id/info_header2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin"
android:text="Test"
style="@style/TextLarge" />
</LinearLayout>
</ScrollView>
下面是截图。这是一直向下滚动的。“测试”应在其下方显示16 dp余量
在框架布局中
<FrameLayout
...
android:layout_marginBottom="56dp"
...
/>
这里56dp是操作栏的大小。使用操作栏高度尺寸将android:layout_marginBottom添加到滚动视图中
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/abc_action_bar_default_height_material"
android:fillViewport="true">
为文本视图添加android:paddingBottom=“20dp”
。谢谢。这将至少在更大的填充空间中起作用,但我仍然不知道为什么ScollView会删除其内容的底部。但这会给我所有页面的底部空白。向下滚动时,问题只出现在一个滚动视图中。我认为是“android:layout_marginTop”