How to prevent Soft Keyboard from resizing background image

前端 未结 12 1840
耶瑟儿~
耶瑟儿~ 2020-12-30 00:09

I have a typical listview with an edittext and a button at the bottom of the activity.

When I click onto the edittext, the sof

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-30 00:40

    Er, let me see ... pictures first!

    The layout file act_login.xml.

    
    
    
    
        
        
        
        
    
        
    
            
    
                
    
                
    
                    
    
                    
    
                    
                
            
    
            
    
                
    
                    
    
                    
                
    
                
    
                    
    
                    
                
    
                
            
        
    
    

    The related Java codes.

    EditText etUsername, etPassword;
    EditText etFocus;
    ViewGroup base;
    int mSelection;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        base=(ViewGroup)getLayoutInflater().inflate(R.layout.act_login, null);
        setContentView(base);
        getWindow().setBackgroundDrawable(base.getBackground());
        base.setBackground(null);
        super.onCreate(savedInstanceState);
    }
    
    @Override
    protected void initViews() {
        etUsername=(EditText)findViewById(R.id.loginUsername);
        etPassword=(EditText)findViewById(R.id.loginPassword);
    
        final ViewGroup item=(ViewGroup)findViewById(R.id.loginItem);
        base.removeView(item);
        final View[] items=new View[item.getChildCount()];
        for(int i=0; i
        
    

    The style part.

    
    

提交回复
热议问题