在scrollview中向下滚动时避免底部空格

时间:2017-04-10 21:46:58

标签: android

当我向下滚动时,不必要的空间即将到来。请帮助我,我正在使用scrollView进行此活动。这是我的.xml文件,请查看它并建议我做什么,因为当我滚动在那个不必要的空间让我的应用变得恶心。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="5dp"
android:paddingRight="5dp"
tools:context="com.example.vishal.a4sa.rubber">

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="Rubber Bowl"
    android:gravity="center"
    android:textColor="#01118c"
    android:padding="@dimen/activity_horizontal_margin"
    android:textStyle="bold"
    android:textSize="30dp"
    android:id="@+id/tv"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true" />

<ImageView
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:id="@+id/image"
    android:background="@drawable/image1"
    android:layout_below="@+id/textView5"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<android.support.v4.widget.Space
    android:layout_width="match_parent"
    android:layout_height="8dp" />


<TextView
    android:layout_width="wrap_content"
    android:layout_height="900dp"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#000000"
    android:id="@+id/content"
    android:layout_alignParentBottom="true"
    android:layout_alignLeft="@+id/imageView"
    android:layout_alignStart="@+id/imageView" />

    </LinearLayout>
    </ScrollView>

1 个答案:

答案 0 :(得分:0)

<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">

     <LinearLayout 
          android:layout_width="match_parent"
          android:orientation="vertical"
          android:layout_height="match_parent"
          android:paddingLeft="5dp"
          android:paddingRight="5dp">

          <TextView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:textAppearance="?android:attr/textAppearanceLarge"
              android:text="Rubber Bowl"
              android:gravity="center"
              android:textColor="#01118c"
              android:padding="@dimen/activity_horizontal_margin"
              android:textStyle="bold"
              android:textSize="30dp"
              android:id="@+id/tv"
              android:layout_alignParentTop="true"
              android:layout_centerHorizontal="true" />

          <ImageView
              android:layout_width="match_parent"
              android:layout_height="300dp"
              android:id="@+id/image"
              android:background="@drawable/image1"
              android:layout_below="@+id/textView5"
              android:layout_alignParentLeft="true"
              android:layout_alignParentStart="true" />

          <android.support.v4.widget.Space
              android:layout_width="match_parent"
              android:layout_height="8dp" />

          <TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textAppearance="?android:attr/textAppearanceMedium"
              android:textColor="#000000"
              android:id="@+id/content"
              android:layout_alignParentBottom="true"
              android:layout_alignLeft="@+id/imageView"
              android:layout_alignStart="@+id/imageView" />

     </LinearLayout>
</ScrollView>