android+实现微信对话框样式,Android开发实现模仿微信小窗口功能【Dialog对话框风格窗口】...

本文实例讲述了android开发实现模仿微信小窗口功能。分享给大家供大家参考,具体如下:

运用方法:

将显示窗口的风格 设置为对话框风格即可

具体效果:

012d6bf750babc1d18f004d1b3425c81.gif

具体实现:

首先我们先定义布局文件:

android:id="@+id/idtatabhost"

android:layout_width="300dp"

android:layout_height="500dp"

android:layout_gravity="center"

android:layout_weight="1">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:src="@drawable/wechat"

android:scaletype="fitxy"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="假的 wechat"

android:textsize="20dp"

android:textcolor="#ffffffff"/>

android:id="@+id/send"

android:οnclick="send"

android:text="点我一下 有惊喜(吓) 。。。"

android:textcolor="#ffffffff"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignparentbottom="true"/>

然后我再活动中照常设置监听事件等方法:

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 中设置 活的的样式为对话框风格

具体如下:

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

android:name=".mainactivity"

android:label="@string/app_name"

android:theme="@android:style/theme.material.dialog"

tools:targetapi="lollipop">

大功告成!

希望本文所述对大家android程序设计有所帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值