简体   繁体   中英

Prevent Recyclerview from resizing when keyboard is visible

Most questions are asking about how to make the recyclerview resize when the soft keyboard is visible, although I want the opposite. The recyclerview already resizes when KB is visible, I tried removing android:windowSoftInputMode="stateVisible|adjustResize" but the same happens, the recyclerview always resizes. How can I achieve what I want (programmatically is preferred)

You could try stating an explicit size for the window your RecyclerView is embedded in, for example if it's in a AlertDialog, following AlertDialog.show() you add:

alertDialog.window!!.setLayout(width: 1000, height: 1300)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM