1. 程式人生 > >Android類似QQ彈窗效果

Android類似QQ彈窗效果

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/father"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.administrator.changeactivityproprety.MainActivity">
    <RelativeLayout
        android:id="@+id/rl1"
        android:background="@color/colorPrimaryDark"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/imageview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       android:src="@mipmap/ic_launcher" />
    <TextView
        android:id="@+id/textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="99"
        android:layout_toRightOf="@+id/imageview"
        android:layout_marginTop="15dp"
        android:layout_marginLeft="15dp"
        android:textColor="@android:color/white"
        android:textSize="18dp"/>
        <ImageView
            android:layout_alignParentRight="true"
            android:paddingTop="15dp"
            android:paddingRight="15dp"
            android:layout_height="30dp"
            android:layout_width="30dp"
            android:src="@drawable/closeha"/>
        </RelativeLayout>
    <RelativeLayout
        android:background="@color/colorPrimary"
        android:layout_below="@id/rl1"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <RelativeLayout
        android:layout_marginTop="15dp"
        android:id="@+id/line1"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:textColor="@android:color/white"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="李煤"
            android:textSize="20dp"
            />
        <TextView
            android:layout_marginTop="10dp"
            android:layout_marginRight="15dp"
            android:layout_alignParentRight="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="15:45"/>
    </RelativeLayout>
    <RelativeLayout
        android:id="@+id/relat1"
        android:layout_marginTop="5dp"
        android:layout_below="@id/line1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="* 你說啥"/>
    </RelativeLayout>
    <RelativeLayout

        android:layout_below="@id/relat1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <EditText
            android:layout_margin="10dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </RelativeLayout>
        </RelativeLayout>
</RelativeLayout>

實際的話,訊息的哪條一般用ListView替代。