欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android編程實(shí)現(xiàn)對(duì)話框形式進(jìn)度條功能示例

 更新時(shí)間:2017年09月12日 10:58:17   作者:ITzhongzi  
這篇文章主要介紹了Android編程實(shí)現(xiàn)對(duì)話框形式進(jìn)度條功能,結(jié)合具體實(shí)例形式分析了Android對(duì)話框形式進(jìn)度條的功能與布局相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下

本文實(shí)例講述了Android編程實(shí)現(xiàn)對(duì)話框形式進(jìn)度條功能。分享給大家供大家參考,具體如下:

MainActivity代碼如下:

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);
    //設(shè)計(jì)進(jìn)度條屬性
    prodialog.setMax(100);
    prodialog.incrementProgressBy(50);
    //明確顯示進(jìn)度
    prodialog.setIndeterminate(false);
    prodialog.setButton(DialogInterface.BUTTON_POSITIVE,"確定",
    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();
  }
}

布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:paddingBottom="@dimen/activity_vertical_margin"
  tools:context="com.example.myapplication.MainActivity">
  <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="顯示進(jìn)度天對(duì)話框"
    android:id="@+id/show"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />
</RelativeLayout>

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開發(fā)入門與進(jìn)階教程》、《Android調(diào)試技巧與常見問題解決方法匯總》、《Android多媒體操作技巧匯總(音頻,視頻,錄音等)》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)

希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論