- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在努力获得一个小的 EditText 以及与屏幕底部或软件键盘底部对齐的两个按钮。基本上我的问题是每次我打开我的 Activity (标记为 adjustResize | stateAlwaysVisible)和布局时:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="bottom"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_alignParentBottom="true">
<LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/soft_input_edit_placeholder">
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/editText1">
<requestFocus></requestFocus>
</EditText>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:weightSum="2" android:id="@+id/soft_input_layout_buttons">
<Button android:layout_width="0dp" android:text="xxx Submit xxx" android:layout_height="wrap_content" android:id="@+id/soft_input_button_submit" android:layout_weight="1"></Button>
<Button android:layout_width="0dp" android:text="xxx Cancel xxx" android:layout_height="wrap_content" android:id="@+id/soft_input_button_cancel" android:layout_weight="1"></Button>
</LinearLayout>
</LinearLayout>
键盘向上滑动,它会调整 Activity 的大小,以便只有编辑文本可见,当我隐藏它时(至少键盘有一个按钮可以让我隐藏它),布局保持在原位,也就是说,它永远不会滑回原位,留下一半的屏幕未被覆盖。
我读到在大多数情况下对齐是通过在布局中引入一些可扩展的控件来实现的,但我真的不希望在那里有任何形式的 ListView;我试过使用 RelativeLayout,还是不行。将一个嵌入另一个 - 仍然没有运气。如果您有任何建议,我将非常感谢,我的想法已经用完了..
谢谢!
最佳答案
问题全部出在选定的主题上。我的 Activity 在 list 中应用了全屏主题(我不知道它会以这种方式影响 View );将其更改为非全屏解决了我的问题(尽管它不能只是任何其他主题)
我通过将 Activity 主题设置为 Theme.Translucent 并将布局主题设置为 Theme (根本没有主题)来实现我的目标;将 @android:drawable/bottom_bar 应用到主 LinearLayout 并最终将主布局的引力设置为 bottom 给了我想要的结果。
关于Android adjustResize 布局用软键盘调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7332991/
我正在努力获得一个小的 EditText 以及与屏幕底部或软件键盘底部对齐的两个按钮。基本上我的问题是每次我打开我的 Activity (标记为 adjustResize | stateAlwaysV
我有一个全屏运行的应用程序: getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutP
这个问题在这里已经有了答案: Is there any way to change android:windowSoftInputMode value from java class? (5 个答案
在 WebView Activity 上使用 android:windowSoftInputMode="adjustResize" 时,只要用户选择文本输入,其内容就会自行调整大小以启用滚动。 但是,
我在 list 中使用了 android:windowSoftInputMode="adjustResize" 来防止键盘隐藏 Activity 按钮。它可以工作,但是当键盘打开时,我的按钮会向上移动
我将表单包装在 中然后我设置 list android:windowSoftInputMode="adjustResize" (默认 react native )。现在,当我用手指触摸事件手动聚焦一
设置 WindowSoftInputMode 后,我们在 Android 中遇到问题至Android.Views.SoftInput.AdjustResize .当键盘显示或隐藏时,我们的启动屏幕会在
每当我启动应用程序时,软输入都会自动弹出,因为它检测到屏幕上的编辑文本。现在我知道,为了防止这种情况发生,一种方法是将 android:windowSoftInputMode="stateHidden
我正在使用这个库:https://github.com/yshrsmz/KeyboardVisibilityEvent检测键盘何时打开或关闭,这依赖于输入到 Android list 的 androi
我目前正在开发一个简单的笔记应用程序,用户可以在其中输入标题和笔记内容。我想要实现的是,当用户单击注释内容 (EditText) 时,软键盘出现,只有注释内容 EditText 的大小减小(调整大小)
我的 android 应用程序中有以下布局,但 Activity 中的 windowSoftInputMode="adjustResize" 有问题。该布局在屏幕底部包含一个下一步按钮。打开键盘时,按
当键盘显示在我的应用程序上时,我想向上移动我的布局。我在 Activity 中使用了 adjustResize、adjustPan 和它们两者,但它们都不起作用,它仍然在窗体上显示键盘并且不会移动上面
我想要一个按钮,当键盘打开时,它应该粘在底部。 具有长格式的线性布局,在垂直方向上包含多个 edittext。 按钮在scrollview的底部和外面 list 有一个adjustsize 属性 因此
尽管这个问题在stackoverflow中有很多解决方案,但我还是无法解决我的问题。我在屏幕上有两个编辑文本,一个在顶部,另一个附在屏幕底部。每当我点击底部编辑文本时,软键盘就会出现在它上面。我已经玩
我已经在多个 Activity 中成功实现了 AdjustResize,但特别是一个 Activity 在显示键盘时仍然拒绝执行任何操作,除了平移。 知道我做错了什么吗? 我正在像这样使用 xamar
我有一个 WebView(在带有 SlidingTabLayout 的 ViewPager 中的一个 Fragment 中)。 当使用 WebView 进行输入时,我希望调整布局大小以确保输入可见。
我不是在寻找代码,我也不会发布任何代码,只是一个解释,因为我有点迷路了。 这个主要问题是出现软键盘时调整大小。 以我为例 我有一个 listView,其中包含 2 个 editText 和许多使用自定
我的 android 应用程序中有以下布局,但 Activity 中的 windowSoftInputMode="adjustResize" 有问题:名为“container”的 LinearLayo
当键盘打开时,屏幕顶部会出现一条白色 strip ,无论键盘状态如何变化,它都会持续存在。 如果我使用 adjustPan 然后它工作,但是,我只想使用 adjustResize。 这是问题的图片:
在我的 Android 应用程序中,对软键盘使用 adjustResize 行为对我来说至关重要。因此,用户可以向下滚动到其他 UI 元素,例如“继续”按钮。 我注意到 adjustResize 仅在
我是一名优秀的程序员,十分优秀!