键入时,Android键盘会显示“底部导航”

时间:2018-08-06 23:07:21

标签: android bottomnavigationview

大家好, 我的底部导航有一个令人讨厌的问题,当显示键盘时,底部导航也上升了,我尝试使用AdjustPan和AdjustResize,但什么都没有:(

将列表器设置为键盘可见性也行不通,即使我在其上设置了“可见性”,仍保留空白。

我的布局由 MainActivity:片段容器+导航栏 片段:工具栏+组件

MainLayout:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:orientation="vertical"

    tools:context=".MainActivity">

    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"

        android:layout_marginBottom="50dp"
        >
    </FrameLayout>

    <com.ashokvarma.bottomnavigation.BottomNavigationBar
        android:id="@+id/activity_with_view_pager"
        android:layout_width="match_parent"
        android:layout_height="50dp"

        android:layout_gravity="bottom"
        >
    </com.ashokvarma.bottomnavigation.BottomNavigationBar>
</FrameLayout>

片段布局:

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

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginStart="0dp"
        android:background="#fff"
        android:contentInsetEnd="0dp"
        android:contentInsetLeft="0dp"
        android:contentInsetRight="0dp"
        android:contentInsetStart="0dp"
        app:contentInsetEnd="0dp"
        app:contentInsetLeft="0dp"
        app:contentInsetRight="0dp"
        app:contentInsetStart="0dp"
        app:layout_collapseMode="pin"
        app:layout_heightPercent="13%"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <!-- This is a centered logo -->
            <ImageButton
                android:id="@+id/back_ImgBtn"
                android:layout_width="15dp"
                android:layout_height="27dp"
                android:layout_centerVertical="true"
                android:layout_marginBottom="4dp"
                android:layout_marginLeft="15dp"
                android:layout_marginTop="24dp"
                android:background="@null"
                android:scaleType="fitCenter"
                android:src="@drawable/back_icon" />

            <ImageView
                android:id="@+id/toolbar_logo"
                android:layout_width="131dp"
                android:layout_height="44dp"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="4dp"
                android:layout_marginTop="30dp"
                android:src="@drawable/peendy_logo" />
        </RelativeLayout>
    </android.support.v7.widget.Toolbar>

    <ScrollView 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="0dp"

        android:layout_below="@id/toolbar"

        android:fillViewport="true"
        app:layout_heightPercent="87%">

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/rr"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:background="#fff"
            android:orientation="vertical">

            <TextView
                android:id="@+id/categoriaView"
                android:layout_width="match_parent"
                android:layout_height="21dp"

                android:layout_alignParentTop="true"
                android:layout_marginEnd="25dp"
                android:layout_marginStart="34dp"

                android:layout_marginTop="20dp"
                android:fontFamily="@font/lato_thin"
                android:text="Categoria:"
                android:textColor="#116A38"
                android:textSize="18sp"
                android:textStyle="bold"
                android:typeface="normal" />

            <LinearLayout
                android:id="@+id/categoriaRoot"
                android:layout_width="match_parent"
                android:layout_height="50dp"

                android:layout_below="@id/categoriaView"
                android:layout_marginEnd="34dp"
                android:layout_marginStart="34dp"

                android:layout_marginTop="12dp"
                android:background="@drawable/layout_rounded"
                android:orientation="horizontal"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/categoriaView">

                <com.peendy.peendy_android.custom.NoDefaultSpinner
                    android:id="@+id/categoria"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.92"
                    android:background="@null"
                    android:prompt="@string/spinner_posizione" />

                <ImageButton
                    android:id="@+id/spinnerImgBtn"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_marginRight="9dp"
                    android:layout_weight="0.08"
                    android:background="@null"
                    android:padding="2dp"
                    android:scaleType="fitCenter"
                    android:src="@drawable/spinner_icon" />
            </LinearLayout>

            <TextView
                android:id="@+id/posizioneView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:layout_below="@id/categoriaRoot"
                android:layout_marginStart="37dp"

                android:layout_marginTop="15dp"
                android:fontFamily="@font/lato_thin"
                android:text="Dove:"
                android:textColor="#116A38"
                android:textSize="18sp"
                android:textStyle="bold"
                android:typeface="normal"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/categoriaRoot" />

            <android.support.percent.PercentRelativeLayout
                android:id="@+id/posizioneRootS"
                android:layout_width="match_parent"
                android:layout_height="50dp"

                android:layout_below="@id/posizioneView"
                android:layout_marginStart="34dp"

                android:layout_marginTop="12dp"
                android:padding="0dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/posizioneView">

                <LinearLayout
                    android:id="@+id/posizioneRoot"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_margin="0dp"
                    android:background="@drawable/layout_rounded"
                    android:clickable="true"
                    android:orientation="horizontal"
                    android:paddingLeft="10dp"
                    app:layout_widthPercent="90.5%">

                    <AutoCompleteTextView
                        android:id="@+id/autocomplete_address"
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_margin="0dp"
                        android:layout_weight="0.92"
                        android:background="@drawable/edittext_style"
                        android:hint="Indirizzo, quartiere, città"
                        android:imeOptions="actionSearch"
                        android:inputType="textPostalAddress"
                        android:padding="0dp"

                        />

                    <ImageButton
                        android:id="@+id/locationImageBtn"
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_marginEnd="7.5dp"
                        android:layout_weight="0.08"
                        android:background="@null"
                        android:padding="2dp"
                        android:scaleType="fitCenter"
                        android:src="@drawable/ic_location" />

                    <com.github.rahatarmanahmed.cpv.CircularProgressView xmlns:app="http://schemas.android.com/apk/res-auto"
                        android:id="@+id/progress_view"
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="center_vertical"
                        android:layout_marginRight="9dp"
                        android:layout_weight="0.08"
                        android:scaleType="fitCenter"
                        android:visibility="gone"
                        app:cpv_animAutostart="true"
                        app:cpv_color="#7CBA43"
                        app:cpv_indeterminate="true"
                        app:cpv_thickness="6px" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/posizioneCancel"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_toRightOf="@id/posizioneRoot"
                    android:background="@drawable/edittext_cancel"
                    android:orientation="horizontal"
                    android:padding="0dp"
                    android:visibility="invisible"
                    app:layout_widthPercent="7.5%">

                    <ImageButton
                        android:id="@+id/posizioneCancelImgBtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="0dp"
                        android:background="@null"
                        android:padding="2dp"
                        android:scaleType="fitCenter"
                        android:src="@drawable/ic_delete_black_24dp" />
                </LinearLayout>
            </android.support.percent.PercentRelativeLayout>

            <com.peendy.peendy_android.custom.ScrollMapView
                android:id="@+id/mapFrag"
                android:layout_width="match_parent"
                android:layout_height="match_parent"

                android:layout_above="@id/seekbar"
                android:layout_below="@id/posizioneRootS"
                android:layout_marginEnd="34dp"

                android:layout_marginStart="34dp"
                android:layout_marginTop="15dp" />

            <com.xw.repo.BubbleSeekBar
                android:id="@+id/seekbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:layout_above="@id/dataView"
                android:layout_centerHorizontal="true"
                android:layout_marginEnd="25dp"
                android:layout_marginStart="34dp"

                android:layout_marginTop="15dp" />


            <TextView
                android:id="@+id/dataView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:layout_above="@id/dataRoot"
                android:layout_marginEnd="25dp"
                android:layout_marginStart="34dp"

                android:layout_marginTop="15dp"
                android:fontFamily="@font/lato_thin"
                android:text="Ordina per il giorno:"
                android:textColor="#116A38"
                android:textSize="18sp"
                android:textStyle="bold"
                android:typeface="normal"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/mapFrag" />

            <LinearLayout
                android:id="@+id/dataRoot"
                android:layout_width="match_parent"
                android:layout_height="50dp"

                android:layout_above="@id/cerca"
                android:layout_marginEnd="34dp"
                android:layout_marginStart="34dp"

                android:layout_marginTop="12dp"
                android:background="@drawable/date_style"
                android:gravity="center"
                android:inputType="number"
                android:orientation="horizontal"
                android:padding="0dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/dataView">

                <EditText
                    android:id="@+id/dateDays"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_marginLeft="10dp"
                    android:layout_weight="0.20"
                    android:background="@null"
                    android:inputType="number"
                    android:maxLength="2"
                    android:textAlignment="center"
                    android:textSize="24sp" />

                <ImageView
                    android:id="@+id/dateSeparator1"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_weight="0.1"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp"
                    app:srcCompat="@drawable/ic_date_separator" />

                <EditText
                    android:id="@+id/dateMonths"
                    android:layout_width="55dp"
                    android:layout_height="50dp"
                    android:background="@null"
                    android:inputType="number"
                    android:maxLength="2"
                    android:textAlignment="center"
                    android:textSize="24sp" />

                <ImageView
                    android:id="@+id/dateSeparator2"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_weight="0.1"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp"
                    app:srcCompat="@drawable/ic_date_separator" />

                <EditText
                    android:id="@+id/dateYears"
                    android:layout_width="0dp"
                    android:layout_height="50dp"
                    android:layout_weight="0.26"
                    android:background="@null"
                    android:inputType="number"
                    android:maxLength="4"
                    android:textAlignment="textStart"
                    android:textSize="24sp" />
            </LinearLayout>

            <Button
                android:id="@+id/cerca"
                android:layout_width="match_parent"
                android:layout_height="50dp"

                android:layout_alignParentBottom="true"
                android:layout_marginBottom="8dp"
                android:layout_marginEnd="35dp"
                android:layout_marginStart="35dp"

                android:layout_marginTop="12dp"
                android:background="@drawable/button_rounded"
                android:elevation="0dp"
                android:stateListAnimator="@null"
                android:text="CERCA"
                android:textColor="#fff"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/dataRoot"
                app:layout_constraintVertical_bias="0.552" />


        </RelativeLayout>
    </ScrollView>
</android.support.percent.PercentRelativeLayout>

0 个答案:

没有答案