猿问

在android中弹出键盘时如何滚动布局

我使用协调器布局进行了以下布局。但是当键盘弹出时,一些元素会在键盘下方,因此失去了可见性。所以请帮我解决这个问题。我已经尝试在 windowSoftInputMode 中放置 adjustPan、adjustResize 但仍然无法正常工作。即使尝试使用嵌套滚动视图,也没有成功。


<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:id="@+id/coordinator"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:background="#fff">



        <android.support.design.widget.AppBarLayout

            android:id="@+id/appbarLayout"

            android:layout_width="match_parent"

            android:layout_height="300dp"

            android:background="@drawable/gradient"

            android:gravity="center">


            <ImageView

                android:layout_width="100dp"

                android:layout_height="100dp"

                android:layout_gravity="center|center_vertical"

                android:background="@drawable/app_main_logo" />


            <TextView

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:layout_gravity="center|center_vertical"

                android:layout_marginTop="20dp"

                android:text="My App"

                android:textColor="#fff"

                android:textSize="20dp" />

        </android.support.design.widget.AppBarLayout>


        <android.support.v7.widget.CardView

            android:id="@+id/loginCardView"

            android:layout_width="match_parent"

            android:layout_height="250dp"

            android:layout_marginLeft="20dp"

            android:layout_marginRight="20dp"

            android:layout_marginTop="250dp"

            app:cardCornerRadius="10dp"

            app:cardElevation="8dp">


           

幕布斯7119047
浏览 167回答 2
2回答

达令说

使用卡片视图到顶部根然后使用任何其他布局......!
随时随地看视频慕课网APP

相关分类

Java
我要回答