Android开发实现模仿微信小窗口功能【Dialog对话框风格窗口】
作者:水中鱼之1999 发布时间:2022-01-27 10:11:01
标签:Android,微信,Dialog对话框
本文实例讲述了Android开发实现模仿微信小窗口功能。分享给大家供大家参考,具体如下:
运用方法:
将显示窗口的风格 设置为对话框风格即可
具体效果:
具体实现:
首先我们先定义布局文件:
<?xml version="1.0" encoding="utf-8" ?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/idtatabHost"
android:layout_width="300dp"
android:layout_height="500dp"
android:layout_gravity="center"
android:layout_weight="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/wechat"
android:scaleType="fitXY"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="假的 WeChat"
android:textSize="20dp"
android:textColor="#ffffffff"/>
<Button
android:id="@+id/send"
android:onClick="send"
android:text="点我一下 有惊喜(吓) 。。。"
android:textColor="#ffffffff"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
然后我再活动中照常设置监听事件等方法:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void send(View source){
finish();
}
}
最重要的部分:
在未见的 mainfest.xml 中设置 活的的样式为对话框风格
具体如下:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Material.Dialog"
tools:targetApi="lollipop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
大功告成!
希望本文所述对大家Android程序设计有所帮助。
来源:https://blog.csdn.net/qq_43377749/article/details/85037821


猜你喜欢
- 本文实例讲述了C#可用于登录验证码的四位随机数生成方法。分享给大家供大家参考。具体实现方法如下:这里提供了两种方法,调用其一即可:using
- 环境JDK 1.8Spring Boot 2.3.0.RELEASEMaven 3.6.1H2 数据库用户名密码登录首先,我们用 Sprin
- 前言上一篇分析了事务注解的解析过程,本质上是将事务封装为切面加入到AOP的执行链中,因此会调用到MethodInceptor的实现类的inv
- 本片shader实现的效果是模型腐蚀消失,且腐蚀的边缘大小可以调、颜色可调。效果图如下:设置面板如下:使用时需要给ClipMask参数给一张
- AutoGenerator 是 MyBatis-Plus 的代码生成器,通过 AutoGenerator 可以快速生成 Entity、Map
- Spring spring-context-indexer依赖<dependencies> <d
- Prim算法介绍1.点睛在生成树的过程中,把已经在生成树中的节点看作一个集合,把剩下的节点看作另外一个集合,从连接两个集合的边中选择一条权值
- 工作中许多代码中用到枚举(enum),更用到了需要继承的枚举,由于C#的枚举不允许被继承(但允许继承自int/float等类型,这个不是我要
- 大家都知道NPOI组件可以在你本地没有安装office的情况下来 读取,创建excel文件。但是大家一般都是只默认读取一个excel文件的第
- 在spring中有很多以XXXAware命名的接口,很多人也不清楚这些接口都是做什么用的,这篇文章将描述常用的一些接口。一,Applicat
- 布局:<?xml version="1.0" encoding="utf-8"?><
- Web控件DropDownList和WinForm控件ComboBox机制不一样。ComboBox没有对应的ListItem需要自己写一个:
- 一、达梦数据库简介说明:有关国产数据库完整的博客太少了,所以就想弄一个完整的专栏给大家提供一些帮助。在现在这种国际形势下,网络安全是每个企业
- 现在智能手机基本都是触摸操作,点击按钮是一种交互方式,同时手势相关的操作,比如滑动等等同样是很重要的交互方式。这篇文章是对安卓手势交互相关知
- Dotnet中嵌入资源(位图、图标或光标等)有两种方式,一是直接把资源文件加入到项目,作为嵌入资源,在代码中通过Assembly的GetMa
- 一、Container 简介flutter 开发中最核心的是用最少的组件(层次)完成功能开发;Container 前端的盒子模型实现,类似
- C#删除指定文件或文件夹public static string deleteOneFile(string fileFullPath) &n
- 引言C#应用通过 Microsoft.Toolkit.Uwp.Notifications NuGet包可以很方便的发送本地通知(Window
- Unity打开Unity Ctrl+9,打开Unity商店,下载TexturePacker Importer插件这个插件是用来解析图集文件的
- //while和for循环可以相互转换,以下为简单格式;for(1;2;3) A;//等价于