问题描述
限时送ChatGPT账号..我想知道是否可以以编程方式或在xml中指定一种使用特定于的
.windowSoftInputMode
的方法片段
假设我只有一个 activity
包含两个 fragment
,一个片段应该使用 adjustPan
,另一个片段应该使用 adjustResize代码>.我应该如何管理?
谢谢!
解决方案您可以通过编程方式更改行为,请参阅此答案.
那么我会怎么做:如果片段 A 恢复,使用 getActivity()
获取对其父活动的引用,然后使用问题中的命令来更改行为.>
然后对片段 B 执行相同的操作,但在设置软输入模式行为时使用另一个参数.
adjustResize
将是:WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
adjustPan
将是:WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
I'm wondering if it's possible to specify programatically or in the xml a way to use a windowSoftInputMode
specific to a Fragment
.
Let's say I have just one activity
that contains two fragment
, one fragment should use adjustPan
and the other one adjustResize
. How should I manage this?
Thanks!
解决方案You can change the behavior programmatically, see this answer for that.
So what I would do: if fragment A is resumed, use getActivity()
to get a reference to its parent activity, and then use the command from the question to change the behavior.
Then do the same with fragment B, but use the other parameter when setting the soft input mode behavior.
adjustResize
would be: WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
adjustPan
would be: WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
这篇关于使用“adjustPan"或“调整调整大小"特定于片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论