QQ的消息提醒有通知栏的还有弹出对话框的,怎么样才能有这种效果:

我是这样做的,不知道对不对,希望大家互相学习。

1.布局文件照着他这样做,代码:
<?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"><RelativeLayoutandroid:id="@+id/rl1"android:background="@color/colorPrimaryDark"android:layout_width="match_parent"android:layout_height="wrap_content"><ImageViewandroid:id="@+id/imageview"android:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@mipmap/ic_launcher" /><TextViewandroid: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"/><ImageViewandroid:layout_alignParentRight="true"android:paddingTop="15dp"android:paddingRight="15dp"android:layout_height="30dp"android:layout_width="30dp"android:src="@drawable/closeha"/></RelativeLayout><RelativeLayoutandroid:background="@color/colorPrimary"android:layout_below="@id/rl1"android:layout_width="match_parent"android:layout_height="match_parent"><RelativeLayoutandroid:layout_marginTop="15dp"android:id="@+id/line1"android:orientation="horizontal"android:layout_width="match_parent"android:layout_height="wrap_content"><TextViewandroid:textColor="@android:color/white"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="李煤"android:textSize="20dp"/><TextViewandroid: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><RelativeLayoutandroid:id="@+id/relat1"android:layout_marginTop="5dp"android:layout_below="@id/line1"android:layout_width="match_parent"android:layout_height="wrap_content"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="* 你说啥"/></RelativeLayout><RelativeLayoutandroid:layout_below="@id/relat1"android:layout_width="match_parent"android:layout_height="wrap_content"><EditTextandroid:layout_margin="10dp"android:layout_width="match_parent"android:layout_height="wrap_content" /></RelativeLayout></RelativeLayout>
</RelativeLayout>

实际的话,消息的哪条一般用ListView替代。

在主活动代码中修改窗口的参数,代码:
package com.example.administrator.changeactivityproprety;import android.app.Activity;
import android.os.Process;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.SeekBar;public class MainActivity extends Activity{RelativeLayout relativeLayout;WindowManager.LayoutParams layoutParams;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.activity_main);layoutParams= getWindow().getAttributes();relativeLayout= (RelativeLayout) findViewById(R.id.father);layoutParams.alpha=0.9f;layoutParams.height=400;getWindow().setAttributes(layoutParams);}
}

只是简单的改变了窗口的高度,还有透明度。

因为Activity后面,还有一层视图,如果不设置,其他部分回事黑色,不能呈现效果

所以:在style.xml中加入自己的style,使它透明
<style name="Transparent"><item name="android:windowIsTranslucent">true</item>
</style>

然后在主配置文件中添加主题

<activity android:name=".MainActivity"
    android:theme="@style/Transparent"

运行效果:

布局中用到的图片,可以随便换

Android类似QQ弹窗效果相关推荐

  1. android 仿qq录音动画,Android实现QQ点赞效果动画 Android动画

    版权声明:本文为代码部落原创文章,转载请注明出处. 前言 点赞是现在社交app中比较常用的功能,一个小小的点赞按钮如果能加上一些有趣动画,一来告诉用户你已经点了赞(这是对一些手残党极大的福音),二来人 ...

  2. android 类似QQ 换皮肤 实现思路 apk资源共享

    android 类似QQ 换皮肤 实现思路 apk资源共享 发布:t80t90s | 发布时间: 2013年3月30日 原文:http://t80t90s.com/view.asp?id=23 1.首 ...

  3. android类似QQ空间,微信朋友圈,微博主页源码

    2019独角兽企业重金招聘Python工程师标准>>> 类似QQ空间,微信朋友圈,微博主页等,展示图片的九宫格控件,自动根据图片的数量确定图片大小和控件大小,使用Adapter模式设 ...

  4. 超简单的JS模仿QQ弹窗效果

    QQ的弹窗效果在网页上用JS的一个moveBy方法就可以实现,moveBy的作用就是 将窗口的位置移动到指定的地方,moveBy(xx,yy)  xx和yy就是移动的偏移量 代码如下: <scr ...

  5. 关于Android类似qq和微信那种在桌面图标右上角更新数字的研究

    记录下这个需求的研究  写的超级随意  大家凑合看 不懂再问 一起探讨 因为我们的产品也需要有即时通讯了  消息更新不可避免   首先 要实现这个功能  当然是要借助系统的Launcher. 而谷歌并 ...

  6. android qq分组管理功能,Android实现QQ分组效果

    布局文件: android:layout_width="fill_parent" android:layout_height="fill_parent" and ...

  7. Android实现QQ分组效果

    布局文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:androi ...

  8. android 类似qq空间微博微信九宫格图片

    直接给代码吧: import android.content.Context; import android.content.res.TypedArray; import android.graphi ...

  9. 利用css的before和after属性,实现类似QQ对话框效果

    实现效果如下: 前面的小三角形的原理是利用两个三角形,一个是黑色,一个白色,利用index属性,让白色的三角形覆盖黑色的三角形,白色三角形比黑色三角形靠右1px.下面是代码: <!DOCTYPE ...

最新文章

  1. 几个定制 iTerm2 的 tip
  2. linux下几种文件系统的测试比较
  3. Xshell登录Ubuntu12.04
  4. 《研磨设计模式》chap9 原型模式Prototype
  5. Linux下社交平台,Linux 启动
  6. 韦冬雪计算机应用,捕获效应下RFID防碰撞算法的研究与应用
  7. iview 可以选择当天 禁用_人脸识别刚要普及,怎么就被禁用了?|人脸识别|人脸信息|世超|rekognition...
  8. 整理一篇Linux drm显示系统的文章
  9. 【译】Redis喜提新数据结构:Redis Streams
  10. dubbo学习之源码创建属于自己的dubbo-demo
  11. A股收盘:深证区块链50指数跌3.80%,爱迪尔等9股涨停
  12. 网页图片压缩优化,提高网站打开速度
  13. [Java] 蓝桥杯ALGO-43 算法训练 A+B Problem
  14. Windows 8 Directx 开发学习笔记(八)要有光
  15. Java中的retainAll()函数笔记
  16. 三星note9刷Android9,三星Note9官方韩版安卓9固件rom刷机包 N960NKSU2CSD3
  17. Word自动生成目录的方法
  18. ios 纯代码怎么适配ipad_关于ios 适配ihone 和 ipad方式
  19. 阿里国际站各数据更新时间汇总
  20. 荣耀加冕,追梦不休 | 我的大学时光

热门文章

  1. 闭环步进电机和伺服电机的区别
  2. mysql 8.0基于事务ddl_MySQL8.0新特性——支持原子DDL语句
  3. 菜鸟网管的入门之路-第一章、网络及硬件篇(5)(6)(7)(8)
  4. mysql导出csv_MySQL查询导出到csv
  5. 基于数字地球对于椭球体的数学原理
  6. [loj 2478][luogu P4843]「九省联考 2018」林克卡特树
  7. Broadcast的注册、发送和接收过程
  8. Spring boot 中使用BBoss-ES进行ES的增删改查
  9. 2019年山东计算机单招学校,2019年山东省单招报考开始,这个学校,值得你了解下!...
  10. 【数据结构与算法09】图