Android ScrollView在顶部添加了额外的空间

Android ScrollView在顶部添加了额外的空间,android,Android,我正在使用嵌套在ScrollView中的TextView。滚动工作正常,但ScrollView似乎在TextView顶部添加了一个额外的填充,如下所示: <ScrollViewTop> <Padding> <TextViewTop> <TextViewContent> <TextViewBottom> <ScrollViewBottom> 如何强制TextView占据整个ScrollView区域?您只需要在ScrollVi

我正在使用嵌套在ScrollView中的TextView。滚动工作正常,但ScrollView似乎在TextView顶部添加了一个额外的填充,如下所示:

<ScrollViewTop>
<Padding>
<TextViewTop>
<TextViewContent>
<TextViewBottom>
<ScrollViewBottom>

如何强制TextView占据整个ScrollView区域?

您只需要在ScrollView中使用此选项:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/textViewHelp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
</ScrollView>


我在xml中输入了您的代码。没有填充物

问题在这里得到了解决:

问题是窗口标题,可通过设置以下内容删除:

getWindow().requestFeature(Window.FEATURE_NO_TITLE);

奇怪的是,我就是从这里来的,而且我还得到了填充物。我添加了一个屏幕截图,这是我从你的xml中得到的。我认为问题在于,您添加到TextView的文本本身可能在标题前面有空格。检查文本否,文本很好,当我使用图像视图而不是文本视图时,同样的问题也会发生。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/textViewHelp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
</ScrollView>
getWindow().requestFeature(Window.FEATURE_NO_TITLE);