使用“adjustPan"或“调整调整大小"特定于片段

编程入门 行业动态 更新时间:2024-10-21 03:34:25
本文介绍了使用“adjustPan"或“调整调整大小"特定于片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我想知道是否可以以编程方式或在xml中指定一种使用特定于windowSoftInputMode的方法片段.

假设我只有一个 activity 包含两个 fragment,一个片段应该使用 adjustPan,另一个片段应该使用 adjustResize.我应该如何管理?

谢谢!

解决方案

您可以通过编程方式更改行为,请参阅此答案.

那么我会怎么做:如果片段 A 恢复,使用 getActivity() 获取对其父活动的引用,然后使用问题中的命令来更改行为.>

然后对片段 B 执行相同的操作,但在设置软输入模式行为时使用另一个参数.

adjustResize 将是:WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZEadjustPan 将是: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:关键词]

本文发布于:2023-04-23 03:12:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1034416.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:片段   大小   adjustPan   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!