Force FullScreen on EditText in Android

后端 未结 2 544
渐次进展
渐次进展 2020-12-15 09:32

I am currently developing an app with Samsung Galaxy Tab 2 as my device.

My Code in the XML is:



        
2条回答
  •  庸人自扰
    2020-12-15 10:33

    You Can Try This

    yourEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if(hasFocus){
                    yourEditText.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
                }
            }
        });
    

    Import LayoutParams of your Parent Layout. Your answer will also work well.

提交回复
热议问题