Erstellen Sie eine Chat-Sprechblase In Android

Ich versuche zum erstellen einer chat-Sprechblase mit text.Dafür bin ich Drei Layoutouts,die Innerhalb des Haupt-Linear-Layout-ich bin mit FramLayout,ich bin Einstellung, die eine 9-patch hintergrund dieser Framlayout.Innerhalb von Framlayout ich bin das hinzufügen eines weiteren RelativeLayout wo ich lege meinen drei textViews und eine Bildansicht.aber Typ long text geht es außerhalb der FramLayout Grenze.Ich weiß nicht, was ich falsch mache oder was ich bin fehlt.Wenn ich mit kleinen text, in dem Sie fit bleiben, aber mit großen text-es geht von selbst Hintergrund Grenze FramLayout.Im Anhang zeige ich meine Blase und yahoo IM-Blase.Ich bin versucht zu erstellen, das gleiche wie yahoo, aber mit einigen anderen Stil.Bitte geben Sie mir Ihren Vorschlag.Ich versuche eine Menge mit verschiedene Möglichkeiten, aber nicht, um Erfolg zu haben.Vielen Dank im Voraus . . Erstellen Sie eine Chat-Sprechblase In Android
Hier, ich lege meine 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>

  • Naja wir müssten sehen, die layout-Datei. Ich bin teilweise zu einem Linearen/RelativeLayouts für diese Art der Sache. FrameLayouts können Holen Sie ein bisschen haarig IMO.
  • Haben Sie versucht, messing mit Polsterung?
  • Ja ich benutze auch versuchen Sie es mit Polsterung und auch Marge.
  • Ich habe geschrieben, einen blog-post über android chat Blasen, Sie können finden die open-source-code gibt es auch.
  • Haben Sie einen Blick auf dieses Projekt : github.com/madhur/android-chat-starter
InformationsquelleAutor aftab | 2012-02-22
Schreibe einen Kommentar