【发布时间】:2015-08-07 22:41:48
【问题描述】:
我使用工具栏创建了一个基本活动并将我的布局添加到其中。但是当我在主要内容中添加滚动视图时,向下滚动时它不会显示底部。缺少的部分似乎与工具栏的高度相同。
我的activitybase.xml:
<?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>
我的 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 边距...
【问题讨论】:
-
为
TextView添加android:paddingBottom="20dp"。 -
谢谢。这至少适用于更大的填充,但我仍然不知道为什么 ScollView 会切断其内容的底部。
标签: android scrollview toolbar