Back to project page dialogplus.
The source code is released under:
Apache License
If you think the Android project dialogplus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.orhanobut.android.dialogplussample; /*from ww w . j a va2s.c o m*/ import android.app.Activity; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.widget.ArrayAdapter; import com.orhanobut.dialogplus.DialogPlus; import com.orhanobut.dialogplus.ListHolder; import com.orhanobut.dialogplus.OnItemClickListener; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayAdapter<String> adapter = new ArrayAdapter<>( this, R.layout.simple_list_item_1, new String[]{"Item 1", "Item 2", "Item 3", "Item 4"} ); final DialogPlus dialog = new DialogPlus.Builder(this) .setHolder(new ListHolder()) // Optional, default:BasicHolder .setHeader(R.layout.header) // Optional .setFooter(R.layout.footer) // Optional .setCancelable(true) // Optional default:true .setGravity(Gravity.BOTTOM) // Optional default:true .setAdapter(adapter) // This must be added .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(Object item, View view, int position) { } }) .create(); dialog.show(); findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.show(); } }); } }