zoukankan      html  css  js  c++  java
  • android多选项表对话框

    activity_main_01.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:orientation="vertical"

           android:layout_width="match_parent"
           android:layout_height="match_parent">

    <Button 

           android:id="@+id/btnMultiple"

           android:layout_width="match_parent"

           android:layout_height="wrap_content"

           android:text="多列表对话框">

    </LinearLayout>

    MainActivity.java:

              public void onCreate(Bundle savedInstanceState){

                   super.onCreate(savedInstanceState);

                   this.setContentView(R.layout.activity_main_02);

                   Button btnMultiple = this.findViewById(R.id.btnMultiple);

                   btnMultiple.setOnClickListener(new View.OnClickListener(){

                        @Override

                        public void onClick(View v){

                            AlterDialog.Builder builder = new AlterDialog.Builder(MainActivity.this);

                            final String dialogs[] = {"置顶聊天","标题未读","删除该聊天"};

                           builder.setItems (dialogs,new DialogInterface.OnClickListener(){

                                   @Override

                                    public void onClick(DialogInterface dialog,int which){

                           Toast.MakeText(MainActivity.this,"你的选项是:"+dialogs[which],Toast.LENGTH.SHORT()).show();

                         }

                       });

                  builder.show();

    }

    });

    }

  • 相关阅读:
    php多态
    ssl certificate problem: self signed certificate in certificate chain
    test plugin
    open specific port on ubuntu
    junit vs testng
    jersey rest service
    toast master
    use curl to test java webservice
    update folder access
    elk
  • 原文地址:https://www.cnblogs.com/xiaoxiaomeng/p/5689974.html
Copyright © 2011-2022 走看看