本文介绍了创建聊天泡沫的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个聊天气泡与一些text.For这个我创建三个Layoutouts,里面主要的线性布局,我使用FramLayout,我设置了9补丁背景,这Framlayout.Inside Framlayout的我增加一个RelativeLayout的我在哪里把我的三个textViews和一个imageView.but型长文本不言而喻FramLayout border.I之外不知道我做错了还是什么,我missing.When我用的小文也保持但适合大文本它超出甚至从背景FramLayout.In附件的边界我显示我的泡泡和雅虎的IM bubble.I想创建同一个像雅虎,但与一些不同的style.Please给我你的suggestion.I尝试有很多不同的方式,但没有得到success.Thanks提前。 。在这里,我把我的Layoutfile

I am trying to create a chat bubble with some text.For this I am create Three Layoutouts,Inside of main Linear Layout I am using FramLayout,I am setting a 9-patch background To this Framlayout.Inside of Framlayout I am adding one more RelativeLayout where I am placing my three textViews and one imageView.but type long text it goes outside of FramLayout border.I don't know what I am doing wrong or what I am missing.When I am using small text it remain fit but with big text it goes out from even Background Border of FramLayout.In attachment I am showing my bubble and yahoo IM bubble.I am trying to create same like yahoo but with some different style.Please give me your suggestion.I try a lot with different ways but not get success.Thanks in advance . .Here I am placing my Layoutfile

     <?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="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/linearListLayout1">

       <FrameLayout
           android:id="@+id/frameLayout1"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           android:background="@drawable/bubbleblue" >

            <RelativeLayout
              android:id="@+id/relativeLayout1"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:minHeight="100dp">

                <TextView
                    android:id="@+id/chattitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="TextView"
                    android:layout_marginTop="10dp"
                    android:layout_marginLeft="10dp"/>

               <TextView android:id="@+id/chatdate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="TextView"
                    android:layout_alignParentRight="true"
                    android:layout_marginTop="10dp"/>

               <TextView android:id="@+id/chatText"
                   android:layout_width="fill_parent"
                   android:layout_height="wrap_content"
                   android:layout_alignBottom="@+id/chatstatus"
                   android:layout_below="@+id/chattitle"
                   android:layout_toLeftOf="@+id/chatstatus"
                   android:text="TextView" />

              <ImageView
                  android:id="@+id/chatstatus"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:src="@drawable/add_picture"
                  android:layout_alignParentRight="true"
                  android:layout_below="@+id/chatdate"
                  android:minHeight="2dip"
                  android:maxWidth="2sp"
                  android:maxHeight="2sp"
                  android:layout_marginRight="2dp"/>
        </RelativeLayout>
  </FrameLayout>

推荐答案

在创建.9patch形象,还必须指定内容区域,你的左边,底部的像素定义。 看看这个。

When creating your .9patch image, you also must specify a content area, which you define with the left, and bottom pixels. Check out this.

这篇关于创建聊天泡沫的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 04:14