作者:程序员小冰,GitHub主页:https://github.com/QQ986945193

新浪微博:http://weibo.com/mcxiaobing

首先给大家看一下我们今天这个最终实现的效果图:

首先说一下,这里利用的是一个dialog,然后设置我们需要的背景图,然后

在java主类中引用即可,当然这个功能,也可以放在查看某个图片的效果上面。大家

看情况集中到自己的项目中即可。下面给大家看一下java实现方法:

package startdialogimageview.qq986945193.startdialogimageview;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.Display;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
/**
* @author :程序员小冰
* @新浪微博 :http://weibo.com/mcxiaobing
* @GitHub: https://github.com/QQ986945193
* @CSDN博客: http://blog.csdn.net/qq_21376985
* @码云OsChina :http://git.oschina.net/MCXIAOBING
*/
public class MainActivity extends Activity { Dialog dia; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); Context context = MainActivity.this;
dia = new Dialog(context, R.style.edit_AlertDialog_style);
dia.setContentView(R.layout.activity_start_dialog); ImageView imageView = (ImageView) dia.findViewById(R.id.start_img);
imageView.setBackgroundResource(R.mipmap.iv_android);
dia.show(); dia.setCanceledOnTouchOutside(true); // Sets whether this dialog is
Window w = dia.getWindow();
WindowManager.LayoutParams lp = w.getAttributes();
lp.x = 0;
lp.y = 40;
dia.onWindowAttributesChanged(lp);
} }

所需要的style样式如下:

   <style name="edit_AlertDialog_style" parent="@android:style/Theme.Dialog">
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<!-- 是否启用标题栏 -->
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<!-- 是否使用背景半透明 -->
</style>

然后就没什么难度了,就是一个imageview . 好了。好了。到此结束吧,不懂得请留言或者私信。源代码需要的可以去

(AndroidStudio版)github下载地址:

https://github.com/QQ986945193/StartDialogImageView

【Android】Android开发启动app弹出一张广告图片,Dialog可以查看大图,查看某个图片功能的更多相关文章

  1. Android ListView 长按列表弹出菜单

    Android ListView 长按列表弹出菜单 设置长按菜单 listView.setOnCreateContextMenuListener(new View.OnCreateContextMen ...

  2. Eclipse无法正常启动,弹出对话框内容为 A Java Runtime...

    1.Eclipse无法正常启动,弹出对话框内容为 A Java Runtime...如下图: 原因分析:由于软件版本的更新或者安装其他开发软件无意之间修改了配置文件中的路径,众所周知,Java虚拟机( ...

  3. 启动Eclipse 弹出"Failed to load the JNI shared library jvm.dll"错误

    启动Eclipse 弹出"Failed to load the JNI shared library jvm.dll"错误,如下 原因:eclipse的版本与jre或者jdk版本不 ...

  4. 启动 Eclipse 弹出“Failed to load the JNI shared library jvm.dll”错误的解决方法!&&在eclipse.ini中为eclipse指定jdk启动

    参考:http://blog.csdn.net/zyz511919766/article/details/7442633 http://blog.sina.com.cn/s/blog_028f0c1c ...

  5. 启动 Eclipse 弹出“Failed to load the JNI shared library jvm.dll”错误的解决方法!

    启动 Eclipse 弹出"Failed to load the JNI shared library jvm.dll"错误的解决方法 http://blog.csdn.net/z ...

  6. VS2015+OpenGL4.0开发编译时弹出错误:glaux.lib(tk.obj) : error LNK2019: 无法解析的外部符号 _sscanf,该符号在函数 _GetRegistrySysColors@8 中被引用

    一.问题描述: VS2015+OpenGL4.0开发编译时弹出如下所示的错误: 1>glaux.lib(tk.obj) : error LNK2019: 无法解析的外部符号 _sscanf,该符 ...

  7. eclipse启动时弹出Failed to create the Java Virtual Machine

    eclipse启动时弹出Failed to create the Java Virtual Machine 一.现象 今天装eclipse的时候出现Failed to create the Java ...

  8. 安装完PyCharm,启动时弹出Failed to load JVM DLLbinserverjvm

    安装完PyCharm,启动时弹出"Failed to load JVM DLL\bin\server\jvm.dll"解决方案 问题描述:打开PyCharm时,弹出"Fa ...

  9. JS网页顶部弹出可关闭广告图层

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. Linux之iptables原理详解

    目录: 一.netfilter与iptables 二.filter.nat.mangle等规则表 三.INPUT.FORWARD等规则链和规则 四.Linux数据包路由原理 五.iptables编写规 ...

  2. ThreadLocal面试六连问

    转自:码农沉思录 中高级阶段开发者出去面试,应该躲不开ThreadLocal相关问题,本文就常见问题做出一些解答,欢迎留言探讨. ThreadLocal为Java并发提供了一个新的思路, 它用来存储T ...

  3. 10分钟 Castle.Windsor 适配 Asp.Net Core 3.0

    Asp.Net Core 3.0以上,不再能通过修改Starup.ConfigureServices返回值(IServiceProvider),所以只能调用IHostBuilder.UseServic ...

  4. XSS 渗透思路笔记

    了解XSS首先要了解HTML里面的元素:共有5种元素:空元素.原始文本元素. RCDATA元素.外来元素以及常规元素. 空元素area.base.br.col. command. embed.hr.i ...

  5. python设计模式之适配器模式

    python设计模式之适配器模式 结构型设计模式一个系统中不同实体(比如,类和对象)之间的关系,关注的是提供一种简单的对象组合方式来创造功能. 适配器模式( Adapter pattern)是一种结构 ...

  6. 基于pcntl的PHP进程池

    想必大家都知道可以通过多进程或者多线程的方式实现异步. PHP多进程编程当前主要有这几种方式, 1>基于pcntl实现多进程,这也是PHP自带的多进程玩法 2>Swoole自己修改PHP内 ...

  7. windows服务器下,mysql运行一段时间之后忽然无法连接,但是mysql服务启动正常

    出现这种情况以前都是重启服务器可以解决,但是治标不治本,一段时间之后仍然会出现此问题. 此问题不是mysql应用程序的问题而是windows server system 的配置问题.因此需要修改win ...

  8. Shell脚本之for循环语句的应用

    在实际工作中,经常会遇到某项任务需要多次执行的情况,而每次执行时仅仅是处理的对象不一样,其他命令相同.这时候可以使用for循环语句,针对不同的取值重复执行相同的命令序列. for循环语句的语法结构: ...

  9. Docker日常使用方式

    前提 在安装docker之前,建议你设置系统的国内镜像源先哦,很快~嗯,快. 阿里云镜像源:https://developer.aliyun.com/mirror/ 安装 安装docker 下面都是官 ...

  10. Dbeaver连接Hive和Mysql的配置

    1.连接Hive 首选需要配置Hive 这里我们采用的是JDBC的连接方式 (1) 在Hive中后台启动hiveserver2 [root@hadoop-101 hive]# bin/hiveserv ...