Файл androidmanifest. xml для активности:
<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()
}
}
}
А вот как я вызываю фрагмент bottom_sheet в действии:
recuperarContrasena = findViewById(R.id.view_recuperar_contraseña)
recuperarContrasena!!.setOnClickListener(){
val addPhotoBottomDialogFragment = RecuperarContraseñaBottomSheet.newInstance()
addPhotoBottomDialogFragment.show(
supportFragmentManager,
"add_photo_dialog_fragment"
)
}