【问题标题】:android header become invisible when soft keyboard shown as well as background compress显示软键盘以及背景压缩时,android标头变得不可见
【发布时间】:2014-12-10 17:16:05
【问题描述】:

我正在创建聊天应用程序,在聊天屏幕中我有标题布局(包括)、列表视图和页脚布局(包括)。

当我点击屏幕压缩的编辑文本背景时,感觉很丑。我在清单中使用了"android:windowSoftInputMode="stateAlwaysHidden|adjustPan" 语句,现在背景没有压缩,但我的整个屏幕向上推,这导致我的标题现在不可见。

任何想法,通过它不压缩背景以及标题将保留在屏幕上

我的屏幕 xml 是:``

<include
    android:id="@+id/header"
    layout="@layout/message_header_unlocked"
    android:focusable="true"
     />



<RelativeLayout
    android:id="@+id/list_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/footer"
    android:layout_below="@+id/header"
    android:background="@drawable/main_bg" >

    <include
        android:id="@+id/attachLayout"
        layout="@layout/attachment_view"
        android:visibility="gone" />

    <ListView
        android:id="@+id/msgList"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/attachLayout"
        android:layout_marginBottom="2dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="0dp"
        android:divider="@null"
        android:dividerHeight="0dp"
        android:listSelector="@android:color/transparent" />
</RelativeLayout>

<include
    android:id="@+id/footer"
    android:layout_alignParentBottom="true"
    android:layout_below="@+id/list_layout"

    layout="@layout/message_footer" />

``

【问题讨论】:

    标签: android layout


    【解决方案1】:

    parulb 已经回答了这个问题...See this tread 得到答案。问题的作者没有将其标记为正确....他引用说“我在开发聊天应用程序时遇到了同样的问题,聊天屏幕带有背景图像。android:windowSoftInputMode="adjustResize" 挤压了我的背景图像以适应显示软键盘后的可用空间,“adjustPan”向上移动整个布局以调整软键盘。解决此问题的方法是在活动 XML 中设置窗口背景而不是布局背景。使用 getWindow().setBackgroundDrawable( ) 在您的活动中。”

    【讨论】:

      猜你喜欢
      • 2011-04-16
      • 2015-11-01
      • 1970-01-01
      • 2012-03-25
      • 2014-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-22
      相关资源
      最近更新 更多