Android Softkeyword在BottomSheetDialogFragment中显示时与底部按钮重叠
我希望软键盘在激活时显示底部按钮的下方,基本上是向上移动底部按钮。目前,它是这样做的,但它与EditText视图下面的按钮重叠,因此键盘的顶部与接收输入的EditText视图的底部相限制 下面是表单的底部。xml:Android Softkeyword在BottomSheetDialogFragment中显示时与底部按钮重叠,android,xml,kotlin,Android,Xml,Kotlin,我希望软键盘在激活时显示底部按钮的下方,基本上是向上移动底部按钮。目前,它是这样做的,但它与EditText视图下面的按钮重叠,因此键盘的顶部与接收输入的EditText视图的底部相限制 下面是表单的底部。xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_height="match_parent" and
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:isScrollContainer="false"
android:fillViewport="true"
>
<LinearLayout
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="vertical"
android:padding="16dp"
app:behavior_hideable="false"
app:behavior_peekHeight="90dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Recupera tu contraseña"
style="@style/BigSectionTitleText"
android:textSize="22sp"
android:layout_marginBottom="10dp"
android:textStyle="bold"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Ingresa el correo electrónico con que te registraste en Así de Rápido, allí te enviaremos las instrucciones sobre como recuperar tu contraseña."
android:gravity="center"
style="@style/BigSectionTitleText"
android:textSize="15sp"
android:layout_marginBottom="10dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="Dirección de correo electrónico"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:layout_marginBottom="10dp"
android:background="@drawable/log_rounded_corners"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/button_solicitar_correo_cambiar_contrasena"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="10dp"
android:layout_marginBottom="30dp"
android:paddingTop="5dp"
android:text="Pedir"
android:textSize="15sp"
android:textStyle="bold"
app:cornerRadius="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_zelle_payment_carrito"
app:rippleColor="@color/colorAccent" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<activity
android:name="com.asiderapido.deliveryapp.LoginActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"></activity>
private var botonRecibirCorreo: MaterialButton? = null
class RecuperarContraseñaBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// get the views and attach the listene
var root = inflater.inflate(
R.layout.register_bottom_sheet, container,
false
)
botonRecibirCorreo = root.findViewById(R.id.button_solicitar_correo_cambiar_contrasena)
botonRecibirCorreo!!.setOnClickListener(){
Toast.makeText(
root.context,
"OK",
Toast.LENGTH_LONG
).show()
}
return root
}
companion object {
fun newInstance(): RecuperarContraseñaBottomSheet {
return RecuperarContraseñaBottomSheet()
}
}
}
recuperarContrasena = findViewById(R.id.view_recuperar_contraseña)
recuperarContrasena!!.setOnClickListener(){
val addPhotoBottomDialogFragment = RecuperarContraseñaBottomSheet.newInstance()
addPhotoBottomDialogFragment.show(
supportFragmentManager,
"add_photo_dialog_fragment"
)
}
下面是我如何调用活动中的底部工作表片段:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:isScrollContainer="false"
android:fillViewport="true"
>
<LinearLayout
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="vertical"
android:padding="16dp"
app:behavior_hideable="false"
app:behavior_peekHeight="90dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Recupera tu contraseña"
style="@style/BigSectionTitleText"
android:textSize="22sp"
android:layout_marginBottom="10dp"
android:textStyle="bold"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Ingresa el correo electrónico con que te registraste en Así de Rápido, allí te enviaremos las instrucciones sobre como recuperar tu contraseña."
android:gravity="center"
style="@style/BigSectionTitleText"
android:textSize="15sp"
android:layout_marginBottom="10dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="Dirección de correo electrónico"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:layout_marginBottom="10dp"
android:background="@drawable/log_rounded_corners"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/button_solicitar_correo_cambiar_contrasena"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="10dp"
android:layout_marginBottom="30dp"
android:paddingTop="5dp"
android:text="Pedir"
android:textSize="15sp"
android:textStyle="bold"
app:cornerRadius="8dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_zelle_payment_carrito"
app:rippleColor="@color/colorAccent" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<activity
android:name="com.asiderapido.deliveryapp.LoginActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"></activity>
private var botonRecibirCorreo: MaterialButton? = null
class RecuperarContraseñaBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// get the views and attach the listene
var root = inflater.inflate(
R.layout.register_bottom_sheet, container,
false
)
botonRecibirCorreo = root.findViewById(R.id.button_solicitar_correo_cambiar_contrasena)
botonRecibirCorreo!!.setOnClickListener(){
Toast.makeText(
root.context,
"OK",
Toast.LENGTH_LONG
).show()
}
return root
}
companion object {
fun newInstance(): RecuperarContraseñaBottomSheet {
return RecuperarContraseñaBottomSheet()
}
}
}
recuperarContrasena = findViewById(R.id.view_recuperar_contraseña)
recuperarContrasena!!.setOnClickListener(){
val addPhotoBottomDialogFragment = RecuperarContraseñaBottomSheet.newInstance()
addPhotoBottomDialogFragment.show(
supportFragmentManager,
"add_photo_dialog_fragment"
)
}