Show entire bottom sheet with EditText above Keyboard

后端 未结 8 1353
北恋
北恋 2020-11-30 21:27

I\'m implementing a UI where a bottom sheet will appear above the keyboard with an EditText for the user to enter a value. The problem is the View is being partially overlap

8条回答
  •  [愿得一人]
    2020-11-30 22:14

    Some answers seem to do the trick better than others but will need modification when using the new material design components instead of the older support libraries while also using kotlin

    Hope this will help someone.

    BottomSheetDialog(this, R.style.DialogStyle).apply {
        setContentView(layoutInflater.inflate(R.layout.bottom_sheet, null))
        window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
        findViewById(R.id.time_et)?.requestFocus()
    
        show()
    }
    

    layout/bottom_sheet.xml

    
    
    
        
    
    
            
    
                
    
                
    
                    
    
                    
    
                        
    
                        
    
                    
    
    
                
    
            
    
    
            

    styes.xml (Split for v-21 for using statusBarColor)

        
    

提交回复
热议问题