仿微信聊天气泡效果实现

微信聊天窗口的信息效果类似iphone上的短信效果,以气泡的形式展现,在Android上,实现这种效果主要用到ListView和BaseAdapter,配合布局以及相关素材,就可以自己做出这个效果,素材可以下一个微信的APK,然后把后缀名改成zip,直接解压,就可以得到微信里面的所有素材了。首先看一下我实现的效果:

                                         

以下是工程目录结构:

                                         

接下来就是如何实现这个效果的代码:

main.xml,这个是主布局文件,显示listview和上下两部分内容。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#f0f0e0" >

    <RelativeLayout 
        android:id="@+id/rl_top"
        android:layout_width="fill_parent"
        android:layout_alignParentTop="true"
    	android:layout_height="wrap_content">
        <TextView 
            android:layout_width="fill_parent"
    		android:layout_height="44dp"
    		android:gravity="center"
    		android:textSize="18sp"
    		android:background="#486a9a"
    		android:textColor="@android:color/white"
    		android:text="Chat"/>
    </RelativeLayout>
    
    <RelativeLayout 
        android:id="@+id/rl_bottom"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:background="#486a9a"
        android:paddingTop="5dp"
    	android:layout_height="wrap_content">
        
        <Button
            android:id="@+id/btn_send"
            android:layout_width="70dp"
            android:layout_height="50dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="10dp"
            android:text="Send" />
        
        <EditText 
            android:id="@+id/et_content"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_toLeftOf="@id/btn_send"
            android:textSize="16sp"/>
  • 8
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 33
    评论
评论 33
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值