進階控制項【安卓5】——資訊氣球、對話方塊

來源:互聯網
上載者:User

標籤:content   alert   提示框   bundle   ble   stat   close   protect   建立   

Toast資訊氣球

 1 Button bt1=(Button)findViewById(R.id.Tbt01); 2 Button bt2=(Button)findViewById(R.id.Tbt02); 3 bt1.setOnClickListener(new OnClickListener() { 4     public void onClick(View v) { 5         Toast.makeText(Toast0.this, "按鈕1短提示", 6             Toast.LENGTH_SHORT).show(); 7     } 8 }); 9 bt2.setOnClickListener(new OnClickListener() {10     public void onClick(View v) {11         Toast.makeText(Toast0.this, "按鈕2長提示",12             Toast.LENGTH_LONG).show();13     }14 });
資訊氣球

 

Dialog(對話方塊)、AlertDialog(警告框)

 1 protected void onCreate(Bundle savedInstanceState) { 2     super.onCreate(savedInstanceState); 3     setContentView(R.layout.dialog); 4     bt = (Button) findViewById(R.id.Dbt); 5     bt.setOnClickListener(new OnClickListener() { 6         public void onClick(View v) { 7             Dialog dialog=new AlertDialog.Builder(Dialog0.this) 8                 .setTitle("警告")                        //設定標題 9                 .setMessage("股市有風險,投資需謹慎")    //顯示資訊10                 .setIcon(R.drawable.go)                    //設定顯示的圖片11                 .create();                                //建立Dialog12             dialog.show();            //顯示對話方塊13         }14 });
警告框

進階控制項【安卓5】——資訊氣球、對話方塊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.