gpt4 book ai didi

java - 如何修复底部按钮上的软键盘重叠?

转载 作者:行者123 更新时间:2023-12-01 19:03:50 24 4
gpt4 key购买 nike

这是我的布局。在我的 list 上,它有windowSoftInputMode:"adjustResize|stayVisible它不一定与我的按钮重叠,但它有大约 2 秒的延迟,然后它将停止在我的按钮上重叠。希望任何人都可以帮助我。我应该使用RelativeLayout吗?

<?xml version="1.0" encoding="utf-8"?>
<ScrollView

xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="vertical"
android:id="@+id/my_scroll_view"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout

android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".login.WelcomeScreenActivity">


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

<ImageView
android:id="@+id/imageView27"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/half_black_view" />

<LinearLayout
android:id="@+id/linearLayout13"
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/login_nxt_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">

<androidx.viewpager.widget.ViewPager
android:id="@+id/welcome_screen_viewPager"
android:layout_width="match_parent"
android:layout_height="130dp"></androidx.viewpager.widget.ViewPager>

<com.google.android.material.tabs.TabLayout
android:id="@+id/welcome_screen_indicator"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp"></com.google.android.material.tabs.TabLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:background="@drawable/blur_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="8dp">

<com.hbb20.CountryCodePicker
android:id="@+id/ccp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
app:ccpDialog_keyboardAutoPopup="false"
app:ccp_arrowColor="@color/white"
app:ccp_autoDetectCountry="true"
app:ccp_contentColor="@color/white"
app:ccp_countryPreference="in,us,nz,gb"
app:ccp_defaultLanguage="ENGLISH"
app:ccp_hintExampleNumber="true"
app:ccp_showFlag="false"
app:ccp_showNameCode="false"
app:ccp_textSize="13sp" />

<View
android:id="@+id/sepratorView"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:background="@color/app_seperator_color" />

<EditText
android:id="@+id/user_number_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:background="@android:color/transparent"
android:fontFamily="@font/montserrat"
android:hint="@string/enter_your_phone_number"
android:inputType="phone"
android:maxLength="11"
android:singleLine="true"
android:textColor="@android:color/white"
android:textColorHint="@color/white"
android:textSize="14sp" />

</LinearLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="20dp"
android:fontFamily="@font/montserrat_light"
android:text="@string/enter_number_recevie_otp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="13sp" />



</LinearLayout>
<Button
android:id="@+id/login_nxt_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rectangle_app_btn"
android:fontFamily="@font/montserrat_medium"
android:text="@string/next"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>

最佳答案

OnCreate 方法中试试这个。

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

关于java - 如何修复底部按钮上的软键盘重叠?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59590808/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com