로그인 인터페이스는 전체 화면 + 배경 이미지 몰입 형 + 키보드가 입력 상자를 팝업 + 키보드 팝업, 배경이 팝업되거나 압축되지 않습니다.

수요:

  • 인터페이스 배경 몰입
  • 키보드 팝업 입력 상자가 차단되지 않습니다.
  • 키보드가 튀어 나오고 배경이 움직이지 않습니다.

렌더링은 다음과 같습니다.
여기에 사진 설명 삽입

인터페이스 레이아웃 파일 : (아래의 LinearLayout과 같이 잭업해야하는 레이아웃 에 android : fitsSystemWindows = "true"속성을 추가 합니다. )

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

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@mipmap/bg" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        android:layout_marginBottom="20dp"
        android:fitsSystemWindows="true"
        android:orientation="vertical">

        <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:background="@null"
            android:hint="请输入账号"
            android:paddingLeft="8dp"
            android:textColor="@android:color/white"
            android:textColorHint="@android:color/white"
            android:textSize="18sp" />

        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:background="@color/colorAccent" />

        <EditText
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_marginTop="12dp"
            android:background="@null"
            android:hint="请输入密码"
            android:paddingLeft="8dp"
            android:textColor="@android:color/white"
            android:textColorHint="@android:color/white"
            android:textSize="18sp" />

        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:background="@color/colorAccent" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_marginTop="20dp"
            android:background="@android:color/white"
            android:text="登录"
            android:textSize="18sp" />
    </LinearLayout>

</RelativeLayout>

매니페스트 파일 구성 : (android : windowSoftInputMode = "adjustResize | stateAlwaysHidden")

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.keyboard">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

인터페이스 활동 코드 :

package com.example.keyboard;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.gyf.immersionbar.ImmersionBar;

public class MainActivity extends AppCompatActivity {
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //沉浸
        ImmersionBar.with(this).init();
    }
}

build.gradle 종속성 : (몰입을 위해 immersionbar 추가)

    implementation 'com.gyf.immersionbar:immersionbar:3.0.0'

숨겨진 문제 (사용에 영향을주지 않음) :
이 문제를 보여주기 위해 레이아웃의 모든 여백을 제거하고 LinearLayout 및 하위 컨트롤에 다른 색상을 추가합니다. 높이 간격과 같은 추가 상태 표시 줄이 있음을 알 수 있습니다. android : fitsSystemWindows 속성을 추가하는 LinearLayout. 제거 할 방법은 없지만 레이아웃 상단에 해제해야하는 다른 컨트롤이 없기 때문에 사용에 영향을줍니다. 다른 컨트롤을 추가해야하는 경우에도 마찬가지입니다. 편집 텍스트에서이 LinearLayout에 추가 할 수 있습니다.
여기에 사진 설명 삽입
다른 솔루션은 다음을 시도합니다. adjustResize
및 전체 화면 몰입 모드가 충돌 할 때 참조 연결에서 AndroidBug5497 해결 방법 모드를 사용했으며 키보드가 팝업 될 때 키보드 위의 상태 표시 줄 높이가있는 빈 위치, 실제로 진흙을 꺼내기 위해 무를 빼내고 있는데 적절한 해결책을 찾지 못했습니다. 그래서 AndroidBug5497Workaround 메서드는 포기되었습니다.

기타 앱 로그인 인터페이스 디자인 :

  • 한 가지 유형은 사용자가 홈 페이지에 들어가서 사용하기 위해 로그인 만 할 수 있다는 것입니다. 이러한 종류의 앱은 일반적으로 여러 로그인 방법을 지원하므로 로그인 인터페이스에는 입력 상자가없고 다른 유형의 로그인 방법에 대한 점프 버튼 만 있습니다. 따라서 전체 화면 + 몰입감이 나타나지 않습니다. + 키보드 + 입력 상자가 차단되지 않음 + 배경이 압축되지 않음 등

예 : Little Red Book여기에 사진 설명 삽입

  • 다른 유형은 앱에 들어가서 직접 사용할 수 있습니다. 사용자가 정보를 게시해야하거나 로그인 인터페이스에 들어가기 위해 내 계정을 적극적으로 클릭해야하는 경우에만 로그인 인터페이스로 들어갑니다.이 방식으로 입력 된 로그인 인터페이스에는 일반적으로 배경 이미지,이 인터페이스가 디자인 되었기 때문에 사용자에게 일부 정보를 전달하기 위해 배경 이미지를 사용할 필요가 없습니다.
    예 : Douyin
    여기에 사진 설명 삽입
    요약하자면 현재 기사에서는이 디자인의 사례가 많지 않습니다. 그것은, 당신은 그것을 해결하기 위해 위의 단계를 따를 수 있습니다;이 기록 만, 질문이 있으시면 의견을 남겨주세요, 감사합니다

참조 연결 1.
안드로이드 입력 방식 상자 팝업 배경 이동 또는 압축 문제
2. 전체 화면 활동 입력 상자 차단, 전체 화면 차단 Edittext, 전체 화면 입력 상자 버그, AndroidBug5497 해결 방법, 몰입 형 입력 상자
3. Android 조정 크기 조정 전체 화면 잘못된 문제
4. Android가 소프트 키보드 팝업을 인식하고 editText가 키보드와 함께 위로 이동하고 배경이 이동하지 않습니다.

추천

출처blog.csdn.net/nongminkouhao/article/details/107983535