向 EditText 添加行时,如何使 ScrollView 动态更改? [英] How do I make my ScrollView dynamically change when adding lines to my EditText?
问题描述
https://gyazo.com/1940054eacbe2e3388ac9e6da0eb2cb1
我有一个线性布局,嵌套在相对布局中,嵌套在滚动视图中.当我向 EditText 添加行时,滚动条不会动态更新,它仍然像在页面顶部一样工作.
I have a linear layout, nested in a relative layout, nested in a scrollview. When I add lines to my EditText the scroll bar doesn't dynamically update, it still acts as if it's at the top of the page.
我已将 ScrollViews 的 fillViewport 设置为 true,我已将每个可以想象的组件的高度约束更改为约束的所有可能变化.
I have set the fillViewport of my ScrollViews to true, I have changed every imaginable component's height constraints to every possible variation of constraint.
任何想法都会很棒,谢谢
Any ideas would be great, thanks
推荐答案
这是由于软键盘造成的.将此添加到清单文件中的活动标记中:
It is happening because of soft-keyboard.Add this to your activity tag in your manifest file:
android:windowSoftInputMode="adjustResize"
或
android:windowSoftInputMode="adjustPan"
例如:
<activity android:name=".MainActivity" android:windowSoftInputMode="adjustResize" android:screenOrientation="portrait" >
</activity>
这篇关于向 EditText 添加行时,如何使 ScrollView 动态更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!