Android Scrollview忽略底部的按钮

时间:2016-05-23 15:27:18

标签: android layout scrollview android-linearlayout

首先,我是Android上的新手。我的问题如下:我想要一个Scrollview(实际上有两个Texftields和一个底部的一个Button)。当TextInput变得太大时,Button太过分了,我无法向上滚动到按钮。我认为ScrollView对于Screen来说太大了。 更多信息:我将它用作TabBar的片段,这是我的整个fragment.xml-File。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    android:fillViewport="false">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <EditText
            android:layout_marginTop="12dp"
            android:layout_marginLeft="@dimen/tf_margin_leftright"
            android:layout_marginRight="@dimen/tf_margin_leftright"
            android:hint="@string/hint_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cj_titleLabel"
            />
        <EditText
            android:layout_marginTop="12dp"
            android:layout_marginLeft="@dimen/tf_margin_leftright"
            android:layout_marginRight="@dimen/tf_margin_leftright"
            android:hint="@string/hint_description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/cj_descriptionLabel"/>
        <Button
            android:layout_marginTop="25dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/buttontitle_send"
            android:id="@+id/cj_submitButton"
            android:layout_gravity="center_horizontal"
            android:onClick="submitJob"/>
    </LinearLayout>
</ScrollView>

错误可能在某处?

<android.support.design.widget.CoordinatorLayout 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.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <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/ThemeOverlay.AppCompat.Light" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="fixed"
            app:tabGravity="fill"/>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"  />
</android.support.design.widget.CoordinatorLayout>

0 个答案:

没有答案