Android仿微信QQ聊天顶起输入法不顶起标题栏的问题

所属分类: 软件编程 / Android 阅读数: 97
收藏 0 赞 0 分享

在这记录一下输入法弹出的一系列问题,有的输入法弹出就把整个布局弹上去,有的输入法弹出布局不会有变化,有的输入法弹出遮盖输入框等等问题,网上也有很多说加着加那的,但是看一下都不是很完整,解决不了所有问题,我在这归纳一下大家拿去用吧!

*****先看看做好的效果图*****

一:AndroidManifest.xml里面对应的activity设置

android:windowSoftInputMode="adjustResize"

二:在activity的xml根布局设置

android:fitsSystemWindows="true"

三:为了listview聊天列表的效果,在listview设置

android:transcriptMode="normal"

四:最后粘贴一下每个用到的地方代码

1:AndroidManifest.xml

<!--聊天室-->
  <activity
   android:name=".activity.ChatRoom"
   android:screenOrientation="portrait"
   android:windowSoftInputMode="adjustResize"/>

2:activity的xml根布局和listview

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="@color/xmlback"
 android:fitsSystemWindows="true">
 <include
  android:id="@+id/include"
  layout="@layout/titlelayout" />
 <ListView
  android:id="@+id/listview"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_above="@+id/botton"
  android:layout_below="@+id/include"
  android:background="@color/xmlback"
  android:divider="@null"
  android:scrollbars="none"
  android:transcriptMode="normal"></ListView>
 <RelativeLayout
  android:id="@+id/botton"
  android:layout_width="match_parent"
  android:layout_height="70dp"
  android:layout_alignParentBottom="true"
  android:background="@drawable/hlistvbackwl1">
  <RelativeLayout
   android:layout_width="match_parent"
   android:layout_height="50dp"
   android:layout_centerVertical="true"
   android:layout_marginLeft="10dp"
   android:layout_toLeftOf="@+id/textsend"
   android:background="@drawable/ltback">
   <EditText
    android:id="@+id/edittext"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="10dp"
    android:background="@null"
    android:hint="输入聊天内容"
    android:textSize="14dp" />
  </RelativeLayout>
  <TextView
   android:id="@+id/textsend"
   android:layout_width="50dp"
   android:layout_height="50dp"
   android:layout_alignParentRight="true"
   android:layout_centerVertical="true"
   android:gravity="center"
   android:text="发送"
   android:textColor="@color/zhucolor"
   android:textSize="14dp" />
 </RelativeLayout>
</RelativeLayout>

以上所述是小编给大家介绍的Android仿微信QQ聊天顶起输入法不顶起标题栏的问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

更多精彩内容其他人还在看

Android网络编程之获取网络上的Json数据实例

这篇文章主要介绍了Android网络编程之获取网络上的Json数据实例,本文用完整的代码实例讲解了在Android中读取网络中Json数据的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

Android中的windowSoftInputMode属性详解

这篇文章主要介绍了Android中的windowSoftInputMode属性详解,本文对windowSoftInputMode的9个属性做了详细总结,需要的朋友可以参考下
收藏 0 赞 0 分享

Android网络编程之UDP通信模型实例

这篇文章主要介绍了Android网络编程之UDP通信模型实例,本文给出了服务端代码和客户端代码,需要的朋友可以参考下
收藏 0 赞 0 分享

Android中使用ListView实现漂亮的表格效果

这篇文章主要介绍了Android中使用ListView实现漂亮的表格效果,本文用详细的代码实例创建了一个股票行情表格,需要的朋友可以参考下
收藏 0 赞 0 分享

Android中刷新界面的二种方法

这篇文章主要介绍了Android中刷新界面的二种方法,本文使用Handler、postInvalidate两种方法实现界面刷新,需要的朋友可以参考下
收藏 0 赞 0 分享

Android SDK三种更新失败及其解决方法

这篇文章主要介绍了Android SDK三种更新失败及其解决方法,需要的朋友可以参考下
收藏 0 赞 0 分享

Android学习笔记——Menu介绍(一)

Android3.0(API level 11)开始,Android设备不再需要专门的菜单键。随着这种变化,Android app应该取消对传统6项菜单的依赖。取而代之的是提供anction bar来提供基本的用户功能
收藏 0 赞 0 分享

Android学习笔记——Menu介绍(二)

这次将继续上一篇文章没有讲完的Menu的学习,上下文菜单(Context menu)和弹出菜单(Popup menu)
收藏 0 赞 0 分享

Android学习笔记——Menu介绍(三)

今天继续昨天没有讲完的Menu的学习,主要是Popup Menu的学习,需要的朋友可以参考下
收藏 0 赞 0 分享

Android显示网络图片实例

这篇文章主要介绍了Android显示网络图片的方法,以实例形式展示了Android程序显示网络图片的方法,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多