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 realize the function of progress bar in the form of a dialog box in Android

2025-03-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the Android how to achieve a dialog form of the progress bar function related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone in this Android how to achieve a dialog form of the progress bar function article will have a harvest, let's take a look.

The MainActivity code is as follows:

Package com.example.myapplication;import android.app.ProgressDialog;import android.content.DialogInterface;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.Toast;public class MainActivity extends AppCompatActivity implements View.OnClickListener {ProgressDialog prodialog; Button show; @ Override protected void onCreate (Bundle savedInstanceState) {super.onCreate (savedInstanceState); setContentView (R.layout.activity_main); show = (Button) findViewById (R.id.show) Show.setOnClickListener (this);} @ Override public void onClick (View view) {prodialog = new ProgressDialog (MainActivity.this); prodialog.setProgressStyle (ProgressDialog.STYLE_HORIZONTAL); prodialog.setTitle (""); prodialog.setMessage ("jb51"); prodialog.setIcon (R.mipmap.ic_launcher); / / Design progress bar properties prodialog.setMax (100); prodialog.incrementProgressBy (50); / / clearly show progress prodialog.setIndeterminate (false) Prodialog.setButton (DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener () {@ Override public void onClick (DialogInterface dialogInterface, int I) {Toast.makeText (MainActivity.this, "hello", Toast.LENGTH_LONG). Show ();}}); prodialog.setCancelable (true); prodialog.show ();}}

Layout file:

This is the end of the article on "how to implement the progress bar function in the form of a dialog box in Android". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to achieve the function of progress bar in the form of a dialog box in Android". If you want to learn more knowledge, you are welcome to follow the industry information channel.

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