键盘打开时图像会部分隐藏,直到我们键入

时间:2019-04-29 06:04:30

标签: android keyboard android-textinputlayout

嗨,我有一个活动,其布局如下图所示(代码块1),其中的一个片段显示在代码块2中。当我单击“编辑文本”按钮时,整个布局向上移动,清单中包含AdjustResize as windowSoftInputMode。此时,我的图像仅部分显示。但是,当我在编辑文本中添加文本时,它会完全显示。我希望即使在编辑文本成为焦点时也能完全显示图像。

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:animateLayoutChanges="true"
    android:fitsSystemWindows="true"
    android:contentDescription="@string/Accessibility_SplashScreen_Label"
    android:focusable="true"
    android:focusableInTouchMode="true">

    <VideoView
        android:id="@+id/video_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:importantForAccessibility="no"/>

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
       />

    <ImageView
        android:id="@+id/Icon"
        android:layout_width="88dp"
        android:layout_height="70dp"
        android:src="@drawable/ic_logo_volt_labs"
        android:layout_marginEnd="44dp"
        app:layout_constraintRight_toRightOf="parent"
        android:importantForAccessibility="no"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="100dp"/>

    <include layout="@layout/toolbar_brand"/>

</androidx.constraintlayout.widget.ConstraintLayout>

容器布局如下所示

<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
app:layout_constraintTop_toBottomOf="@id/toolbarLayout"
android:padding="@dimen/std_margin_main_container"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:background="@color/color_background_dark"
android:theme="@style/TextInputLayoutAppearance">


<LinearLayout
    android:id="@+id/accountDetails"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:layout_constraintBottom_toTopOf="@id/createAccount"
    android:layout_marginBottom="63dp"
    >

    <androidx.appcompat.widget.AppCompatTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:layout_marginBottom="@dimen/margin_30"
        style="@style/TextAppearance.AppCompat.Subhead"
        android:text="@string/Register_account_details"
        android:textColor="@color/hockeyapp_background_white"
        android:padding="@dimen/std_padding_txt_button"
        />

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/nameTextInputLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/std_margin_top_bottom"
        >

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@style/TextAppearance.AppCompat.Subhead"
            tools:text="@string/Register_Name"
            android:textColor="@color/hockeyapp_background_white"
            android:hint="@string/Register_Hint_Name"
            android:maxLines="1"
            android:singleLine="true"
            android:imeOptions="actionNext"
            android:gravity="end"/>

    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/yearTextInputLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/std_margin_top_bottom"
        >

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/year"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@style/TextAppearance.AppCompat.Subhead"
            tools:text="@string/Register_DoB"
            android:textColor="@color/hockeyapp_background_white"
            android:hint="@string/Register_Hint_DoB"
            android:maxLines="1"
            android:inputType="number"
            android:singleLine="true"
            android:imeOptions="actionNext"
            android:gravity="end"/>

    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/postCodeTextInputLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/postCode"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            style="@style/TextAppearance.AppCompat.Subhead"
            tools:text="@string/Register_Postcode"
            android:textColor="@color/hockeyapp_background_white"
            android:hint="@string/Register_Hint_Postcode"
            android:maxLines="1"
            android:inputType="number"
            android:singleLine="true"
            android:imeOptions="actionDone"
            android:gravity="end"/>

    </com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

<androidx.appcompat.widget.AppCompatButton
    android:id="@+id/createAccount"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    android:text="@string/Register_next_step"
    tools:text="@string/Register_create_account"
    android:textAllCaps="false"
    style="@style/TextAppearance.AppCompat.Subhead.SemiBold"
    android:textColor="@color/base_text_dark"
    android:layout_marginBottom="66dp"
    android:background="@drawable/rounded_button_light"
    />

enter image description here enter image description here enter image description here

0 个答案:

没有答案