Add this in your manifest, in the activity you want to look like dialog, declaration:
<activity android:theme="@android:style/Theme.Dialog">
for more information and themes:
http://developer.android.com/guide/topics/ui/themes.html
furthermore, to this proggramatically you can use the following code:
public class ShowDialogActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
//
//Log.d("DEBUG", "showing dialog!");
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.select_dialog_singlechoice);
dialog.setTitle("Your Widget Name");
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
TextView text = (TextView) dialog.findViewById(R.id.text1);
text.setText("Message");
dialog.show();
//
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface arg0) {
finish();
}
});
}
}
You can choose whatever layout you wish for the dialog and design it as you want.
In addition you would need to set this activity declaration in the manifest for the following:
<activity android:name=".ShowDialogActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
Hope this is what you was looking for, Gal.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…