【问题标题】:android - windowSoftInputMode issueandroid - windowSoftInputMode 问题
【发布时间】:2017-10-05 18:30:07
【问题描述】:

如何在打开软输入时在红色区域显示相对布局?我尝试了 adjustPan 和 adjustResize 输入模式,但没有发生。有什么想法吗?


【问题讨论】:

    标签: android android-layout window-soft-input-mode


    【解决方案1】:

    首先,将 android:windowSoftInputMode="adjustResize" 添加到 manifest.xml 中的活动中。

    然后创建如下布局。

    • 作为家长,使用RelativeLayout
    • 放入 2 个子项(滚动视图和底视图)
    • 底视图aligned to bottom
    • ScrollView 位于底部视图 above

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ScrollView
            android:layout_above="@+id/bottomView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            //scrollable content
        </ScrollView>
    
        <RelativeLayout
            android:id="@+id/bottomView"
            android:layout_alignParentBottom="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
            //your bottom content
        </RelativeLayout >
    </RelativeLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-05
      • 1970-01-01
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多