Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display Image by Dialog in Android Development

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you about how Dialog displays images in Android development. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Dialog generally refers to the small window that can be displayed in front of the Activity, the current Activity loses focus (Focus), Dialog will accept user input, generally can be used to display messages or accept user input, and so on. It is generally not necessary to create an instance of the Dialog class directly when using Dialog. Instead, you can use AlertDialog,ProgressDialog,DatePickerDialog,TimePickerDialog. The most commonly used is AlertDialog. Here are three examples of using AlertDialog as an example, using AlertDialog to choose to display an image: DrawMap, JumbleImage,SeeThroughImage. Among them, DrawMap will not be introduced for the time being. We will talk about it later when we introduce the Internet application to display online maps.

Usually Dialog is created as part of activity, that is, it is created in Activity's onCreateDialog (int). When you create a Dialog in onCreateDialog (int), the Android system automatically manages the state of the Dialog and takes the current Activity as the owner of the Dialog. And Dialog inherits some of the properties of the current Activity, such as Option Menu.

After you have created the Dialog, you can use showDialog (int) to display the Dialog, and the parameter of showDialog is the ID of Dialog. Before displaying Dialog, if you want to make some changes to Dialog, you can add code to onPrepareDialog (int, Dialog). Dismiss () closes the dialog box. Use dismissDialog (int) if you are in Activity.

In this example, a button is used to trigger Dialog, and add images.xml in res\ layout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report