仅当键盘可见时,ScrollView才会滚动

时间:2016-05-19 11:47:00

标签: android scrollviewer

我有一个带有6个线性布局的Frame布局,最后一个包含2个按钮我想滚动超过这2个按钮。但它只在键盘可见时滚动,键盘弹出它按下2个按钮 所以当keyBoard不可见时如何滚动?如何阻止它按下按钮?

这是我的代码:

   <FrameLayout 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"
tools:context="layout.Depart"
android:background="@mipmap/degrade">
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:fillViewport="true">

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_above="@+id/linearLayout3"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_marginTop="20sp"
        android:background="@drawable/customborder"
        android:orientation="horizontal"
        android:weightSum="3">




        <EditText
            android:id="@+id/autoCompleteTextView1"
            android:inputType="textAutoComplete|textAutoCorrect"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:ems="10"
            android:gravity="center"
            android:hint="Destination"
            android:textColor="#ffffff"
            android:textColorHint="#FFFFFF"
            android:textSize="20sp"
            android:background="@android:color/transparent"
            android:drawableLeft="@drawable/icondepart"
            android:adjustViewBounds="true"
            android:scaleType="fitXY"
            android:drawablePadding="2dip"
            android:paddingLeft="30sp"
            android:paddingRight="26dip"
            android:focusable="false"/>

    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout3"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginTop="20sp"
        android:background="@drawable/customborder"
        android:orientation="horizontal"
        android:weightSum="3">


        <EditText
            android:id="@+id/display_date"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:textColor="#ffffff"
            android:hint="Date"
            android:textColorHint="#FFFFFF"
            android:textSize="20dp"
            android:focusable="false"
            android:background="@android:color/transparent"
            android:drawableLeft="@drawable/icondate"
            android:adjustViewBounds="true"
            android:scaleType="fitXY"
            android:drawablePadding="2dip"
            android:paddingLeft="30sp"
            android:paddingRight="26dip"/>


         </LinearLayout>
    <LinearLayout
        android:id="@+id/TimeLayout"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/linearLayout3"
        android:layout_marginTop="20sp"
        android:background="@drawable/customborder"
        android:orientation="horizontal"
        android:weightSum="3">


        <EditText
            android:id="@+id/TimeVol"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:hint="Time"
            android:textColor="#ffffff"
            android:textColorHint="#FFFFFF"
            android:textSize="20dp"
            android:background="@android:color/transparent"
            android:drawableLeft="@drawable/iconheure"
            android:adjustViewBounds="true"
            android:scaleType="fitXY"
            android:drawablePadding="2dip"
            android:paddingLeft="30sp"
            android:paddingRight="26dip"
            android:focusable="false"/>
    </LinearLayout>
    <LinearLayout
        android:id="@+id/linearLayout4"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/linearLayout3"
        android:layout_marginTop="20sp"
        android:background="@drawable/customborder"
        android:orientation="horizontal"
        android:weightSum="3">


        <EditText
            android:id="@+id/numv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:hint="Num du vol"
            android:textColor="#ffffff"
            android:textColorHint="#FFFFFF"
            android:textSize="20dp"
            android:background="@android:color/transparent"
            android:drawableLeft="@drawable/iconnumvol"
            android:adjustViewBounds="true"
            android:scaleType="fitXY"
            android:drawablePadding="2dip"
            android:paddingLeft="30sp"
            android:paddingRight="26dip"/>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout5"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/linearLayout4"
        android:layout_marginTop="20sp"
        android:background="@drawable/customborder"
        android:orientation="horizontal"
        android:weightSum="3"
        android:focusable="false">


        <EditText
            android:id="@+id/airp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:hint="Aéroport"
            android:textColor="#ffffff"
            android:textColorHint="#FFFFFF"
            android:textSize="20dp"
            android:background="@android:color/transparent"
            android:drawableLeft="@drawable/iconairport"
            android:adjustViewBounds="true"
            android:scaleType="fitXY"
            android:drawablePadding="2dip"
            android:paddingLeft="30sp"
            android:paddingRight="26dip"
            android:focusable="false"/>

    </LinearLayout>




</LinearLayout>




</ScrollView>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="63dp"
    android:orientation="horizontal"
    android:weightSum="2"
    android:layout_gravity="bottom">
    <Button
        android:id="@+id/rechD"
        android:layout_width="390dp"
        android:layout_height="63dp"
        android:layout_marginTop="20dp"
        android:background="#0A8DB2"
        android:text="Rechercher"
        android:textColor="#ffffff"
        android:layout_weight="1"
        android:layout_gravity="right" />

    <Button
        android:id="@+id/historique"
        android:layout_width="390dp"
        android:layout_height="63dp"
        android:layout_marginTop="20dp"
        android:background="#FFFF"
        android:text="Historique"
        android:textColor="@color/blue_light"
        android:layout_weight="1"
        android:layout_gravity="right" />



</LinearLayout>

0 个答案:

没有答案