android:windowSoftInputMode =“" adjustPan"不管用 [英] android:windowSoftInputMode="adjustPan" is not working

查看:484
本文介绍了android:windowSoftInputMode =“" adjustPan"不管用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有愚蠢的问题,请按照以下图片

I have silly problem please follow the below pics

当我单击Enter Email时,如下图所示,

And when i clicked on Enter Email it saw like below pic,

现在,尽管使用了 android:windowSoftInputMode ="adjustPan" android Lollipop主题和工具栏,问题仍然存在,

Now the problems are coming inspite of using android:windowSoftInputMode="adjustPan" android Lollipop theme and toolbar,

  1. 图像变小.
  2. 电子邮件编辑文本应该已经在键盘上方显示了,但是没有显示.

建议一些解决方案.

推荐答案

首先请确保您在xml布局中提供了ScrollView.

First of all make sure you have provided a ScrollView in your xml layout.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >  
...

...

</ScrollView>

然后在您的activity内部,确保您正在执行以下操作(此代码仅用于演示在哪里使用getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);):

Then inside your activity make sure you are doing something like this(this code is just to demonstrate where to use getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);) :

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.temp);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    final EditText time = (EditText)findViewById(R.id.timeET);
    time.setOnTouchListener(new OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            time.requestLayout();
            MyActivity.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);

            return false;
        }
    });
    final EditText date = (EditText)findViewById(R.id.dateET);
    date.setOnTouchListener(new OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            date.requestLayout();
            MyActivity.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);

            return false;
        }
    });
     }

这篇关于android:windowSoftInputMode =“&quot; adjustPan&quot;不管用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆