创建类似于微信或QQ聊天视图的Android库:ChatMessageView

ChatMessageView能够帮助你快速创建聊天视图,类似于在微信或QQ聊天看到的。它是一个容器视图,所以你添加任何类型的消息如TextView或任何自定义的TextView, ImageView等。

特性

  1. Can have any child inside of it.
  2. You can change color ofChatMessageViewnormal and pressed.
  3. Adjustable arrow position (top, bottom, left, right)
  4. Adjustable arrow gravity (start, end, center)
  5. Chat view without arrow

Sample Screen

ChatMessageView

Installation

add gradle dependency to your dependency list:

dependencies {
    compile 'me.himanshusoni.chatmessageview:chat-message-view:1.0.2' }

Use

  1. IncludeChatMessageViewin your xml of adapter view with content inside.
<me.himanshusoni.chatmessageview.ChatMessageView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cmv_backgroundColor="#88BABABA"
    app:cmv_backgroundColorPressed="#FFBABABA"
    app:cmv_cornerRadius="3dp" >

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello" />

        <!-- ... -->

</me.himanshusoni.chatmessageview.ChatMessageView>

Customization

Attributes:

app:cmv_arrowGravity="start|end|center"
app:cmv_arrowPosition="right|left|top|bottom"
app:cmv_arrowMargin="3dp"
app:cmv_contentPadding="10dp"
app:cmv_backgroundColor="#88BABABA"
app:cmv_backgroundColorPressed="#FFBABABA"
app:cmv_cornerRadius="3dp"
app:cmv_showArrow="true|false"

Description:

  • cmv_arrowGravitycontrols relative position of arrow. possible values arestart,endandcenter. default isleft.
  • cmv_arrowPositioncontrols poition of the arrow outside the box. possible values areright,left,topandbottom. default isleft.
  • cmv_arrowMargincontrols margin of arrow. Ifcmv_arrowPositionisleftorrightit controls top and bottom margin. else it controls left and right margin.
  • cmv_contentPaddingadjusts padding of content within the box.
  • cmv_backgroundColorsets background color ofChatMessageViewin normal mode including arrow.
  • cmv_backgroundColorPressedsets background color ofChatMessageViewin pressed mode including arrow.
  • cmv_cornerRadiussets corner radius of the box.
  • cmv_showArrowshows / hides arrow fromChatMessageView.

项目主页:http://www.open-open.com/lib/view/home/1442134869085

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值