prevent背景调整大小和prevent自动对焦上的活动启动 [英] Prevent background resize AND prevent auto-focus on activity start

查看:135
本文介绍了prevent背景调整大小和prevent自动对焦上的活动启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查找上堆栈溢出的各种问题后,我发现许多人存在以下问题:


  1. 背景被软键盘打开时调整

  2. 软键盘活动开始时打开

在解决这两个谎言的 ActivityManifest.xml

要prevent从软键盘打开时被调整的背景图片,你可以添加的android:windowSoftInputMode =stateVisible | adjustPan<活动方式> 在清单

要prevent软键盘开幕活动开始时,你可以添加的android:windowSoftInputMode =stateHidden<活动方式> 在清单

这是一个解决方案,需要 stateHidden 和其他需要的事实 stateVisible 意味着我不能使用这两种解决方案。我从偷焦点上的活动的开始,但希望prevent软键盘的 prevent软键盘从调整的背景,当用户的确实的决定专注于的EditText

有没有一个可行的解决方案,这两个问题?


解决方案

  

事实上,一个解决方案需要stateHidden和其它需要
  stateVisible意味着我不能使用这两种解决方案。


是的。但是,你可以使用 stateHidden |。adjustPan

除非用户点击的EditText 键盘不会弹出。和你的背景的潜在变化将在定位方面;不会发生的背景缩放

After looking up various questions on stack overflow, I have found that many other people had the following problems:

  1. Background gets resized when soft keyboard opens
  2. Soft keyboard opens when activity starts

The solution to both of these lies in the ActivityManifest.xml.

To prevent the background image from being resized when the soft keyboard opens, you can add android:windowSoftInputMode="stateVisible|adjustPan" to the <activity> in the manifest.

To prevent the soft keyboard opening when the activity starts, you can add android:windowSoftInputMode="stateHidden" to the <activity> in the manifest.

The fact that one solution requires stateHidden and the other requires stateVisible means that I cannot use both solutions. I am looking to prevent the soft keyboard from stealing focus on activity start but also prevent the soft keyboard from resizing the background when the user does decide to focus on the EditText.

Is there a viable solution to both of these issues?

解决方案

The fact that one solution requires stateHidden and the other requires stateVisible means that I cannot use both solutions.

Yes. But, you can use stateHidden|adjustPan.

Keyboard will not pop up unless user clicks on an EditText. And potential changes to your background will be in terms of positioning; scaling of the background will not occur.

这篇关于prevent背景调整大小和prevent自动对焦上的活动启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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