【问题标题】:Need suggestion for implementing list in android. Please...需要在 android 中实现列表的建议。请...
【发布时间】:2023-03-07 07:42:01
【问题描述】:

我有一个包含 20 行的 ListView 控件,每行包含 EditText。在我的例子中,当键盘打开时,前 7 行是可见的。考虑我选择了从 8 到 20 的任何行中的任何 EditText,所选行将位于键盘上方。 Then I tries to type on keyboard, the ListView moves to top and the row containing the EditText in which I was editing should be hidden by the keyboard

Actually I want the row should be in same position just above the keyboard even while typing on keyboard.

Screen1 : Screen seems like this when opened

Screen2 : When row #9 is selected, seems fine as the selected row came just above the keyboard

Screen3 : While typing on keyboard, screen seems like this as the list scrolls to top

Screen4 : On hiding the keyboard, screen seems like this with entered text

请告诉我解决方案..请

【问题讨论】:

    标签: android android-layout android-intent android-listview android-emulator


    【解决方案1】:

    我希望这会对你有所帮助。将此代码添加到您的 manifest.xml 特定活动中。

    android:windowSoftInputMode="adjustPan"
    

    【讨论】:

    • 我已经在我的 manifeat.xml 文件中给出了同样的问题。
    【解决方案2】:

    在 manifest.xml 中的活动中添加以下行

    android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
    

    【讨论】:

    • 如果我尝试此行位置,即使我可以在 EditText 中键入文本,但如果我收回隐藏键盘,我的 EditText 值将丢失。
    猜你喜欢
    • 2020-03-30
    • 2015-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多