消息气泡 安卓

来源:互联网 发布:女程序员转行做什么好 编辑:程序博客网 时间:2024/04/30 06:49

运行效果图:



布局文件代码

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="horizontal">    <TextView        android:padding="2dp"        android:layout_width="60dp"        android:layout_height="50dp"        android:gravity="center"        android:text="012345" />        <TextView            android:layout_width="20dp"            android:layout_height="20dp"            android:layout_gravity="right"            android:background="@drawable/tips_bg"            android:gravity="center"            android:text="1"            android:textSize="15dp"            android:textStyle="bold"            android:textColor="@android:color/white" /></LinearLayout>

tips_bg.xml(画圆文件代码如下)

<pre style="background-color: rgb(255, 255, 255); font-family: 宋体; font-size: 9pt;"><pre style="background-color: rgb(255, 255, 255); font-family: 宋体; font-size: 9pt;"><span style="font-style:italic;"></span>

<?xml version="1.0" encoding="utf-8"?><shape    xmlns:android= "http://schemas.android.com/apk/res/android"    android:shape= "oval"    android:useLevel= "false" >    <solid android:color= "#FF0000" /></shape>
从上面的代码看出气泡就是一个大的TextView.

1 0