• android气泡消息提醒布局


      无论是anroid还是ios,气泡消息提醒再正常不过了。然而要定义一个气泡消息提醒确要费一番周折。下面记录下气泡提醒布局。

      定义气泡背景shape_unread_message_bg.xml

    <?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>

      定义气泡布局,关键点是android:layout_gravity="top|right"

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
    
                    <ImageView
                        android:id="@+id/img_cells"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:src="@mipmap/ic_launcher" />
                    <TextView
                        android:id="@+id/tab_unread_message"
                        android:layout_width="14dp"
                        android:layout_height="14dp"
                        android:layout_alignParentRight="true"
                        android:layout_marginRight="14dp"
                        android:background="@drawable/shape_unread_message_bg"
                        android:gravity="center"
                        android:textColor="@android:color/white"
                        android:textSize="8sp"
                        android:layout_gravity="top|right"
                        android:visibility="gone"
                        />
                </FrameLayout>

      此处需要注意的是,如果数字过大。出现"..."时无法居中,其实这是英文"..."导致的问题,换成"···"即可。

  • 相关阅读:
    Spring MVC异常处理
    Spring MVC 数据校验
    Spring MVC 拦截器(Interceptor)
    Spring MVC 表单标签库
    Spring MVC 数据格式化(Formatter)
    Spring MVC 类型转换器(Converter)
    Spring MVC @ModelAttribute注解
    Spring MVC @Autowired和@Service注解
    如何在Storyboard中使用Scroll view
    学好Python的五本书
  • 原文地址:https://www.cnblogs.com/rwxwsblog/p/5649421.html
Copyright © 2020-2023  润新知