首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android QQ和微信 聊天页面的一个有关问题!内有详细说明

2012-01-20 
android QQ和微信 聊天页面的一个问题!!!!!!内有详细说明界面简化一下,一个listview显示消息队列,一个横向

android QQ和微信 聊天页面的一个问题!!!!!!内有详细说明
界面简化一下,一个listview显示消息队列,一个横向linearlayout显示一个文本框和一个输入按钮,一个横向linearlayout显示两个图片button,上下顺序也是这个顺序,下面两个linearlayout放在底部, 我是通过设置layout_weight的方式实现的,代码如下

XML code
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent" android:layout_height="fill_parent"    android:background="@color/gray" android:orientation="vertical">    <LinearLayout android:id="@+id/body" android:layout_width="fill_parent"        android:layout_height="fill_parent" android:layout_weight="1"        android:orientation="vertical" android:weightSum="1">        <ListView android:id="@+id/chat_list" android:cacheColorHint="@null"            android:divider="@drawable/divider_group" android:groupIndicator="@drawable/expand_group"            android:listSelector="@drawable/list_alpha_selector"            android:transcriptMode="alwaysScroll" android:layout_height="346dp"            android:layout_weight="1.05" android:layout_width="wrap_content" />        <LinearLayout android:layout_width="fill_parent"            android:layout_height="wrap_content" android:layout_weight="0"            android:background="@color/gray_blue" android:gravity="center_vertical">            <Button android:id="@+id/chat_emotion" android:layout_width="wrap_content"                android:layout_height="wrap_content" android:layout_weight="0"                android:background="@drawable/chat_emotion_selector" />            <EditText android:id="@+id/chat_input" android:layout_width="fill_parent"                android:layout_height="fill_parent" android:layout_weight="1"                android:background="@drawable/chat_input_selector"                android:singleLine="true" />            <Button android:id="@+id/chat_send" android:layout_width="wrap_content"                android:layout_height="wrap_content" android:layout_weight="0"                android:background="@drawable/button" android:onClick="onClick"                android:text="发送" android:textColor="@color/white" android:textSize="18dip" />        </LinearLayout>    </LinearLayout>    <LinearLayout android:id="@+id/bottom"        android:layout_width="fill_parent" android:layout_height="wrap_content"        android:layout_weight="0" android:background="@drawable/bottom">        <LinearLayout android:layout_width="fill_parent"            android:layout_height="wrap_content" android:layout_weight="1"            android:gravity="center_horizontal">            <ImageButton android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_centerHorizontal="true" android:background="@drawable/option_selector" />        </LinearLayout>        <LinearLayout android:layout_width="fill_parent"            android:layout_height="wrap_content" android:layout_weight="1"            android:gravity="center_horizontal">            <ImageButton android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_centerHorizontal="true" android:background="@drawable/add_selector" />        </LinearLayout>    </LinearLayout></LinearLayout> 



现在有一个非常重要的问题就是当我点击输入框的时候,会弹出输入法界面,而输入法界面不是只将输入框的整个linearlayout布局顶上去,而是将输入框的整个linearlayout以及下面个两个图片按钮的linearlayout一起顶了上去。。。。。。这个应该如何搞啊



[解决办法]
activity 中配置android:windowSoftInputMode吧
[解决办法]
你在 上面布局文件 后面加上一句 <ScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content"></ScrollView>
试试,应该没问题的 ,另外你的布局文件 不要嵌套那么多linnearLayout 有必要?

热点排行