0

HI I have a game level screen..when touch a level to play I need to give instruction alert/popup window(scrolable) for it.

It should be customized..likes popup in angry-bird..

own background image no borders with only ok button

Please help me Im about to publish this to GOOGLEPLAY...

0

3 Answers 3

1
@Override protected Dialog onCreateDialog(int id) { // TODO Auto-generated method stub switch (id) { case 0: final Dialog mDialog = new Dialog(this); mDialog.setContentView(R.layout.customdialog); mDialog.setTitle("Custom Dialog"); mDialog.show(); mDialog.setCancelable(false); final EditText txtUser = (EditText)mDialog.findViewById(R.id.txtUserName); Button btnButtonOK = (Button)mDialog.findViewById(R.id.btnOK); Button btnButtonCancel = (Button)mDialog.findViewById(R.id.btnCancel); btnButtonOK.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String user = txtUser.getText().toString(); if (!user.equals("")) { Toast.makeText(getApplicationContext(), user, Toast.LENGTH_LONG).show(); mDialog.dismiss(); } } }); btnButtonCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub mDialog.dismiss(); } }); break; } 
Sign up to request clarification or add additional context in comments.

1 Comment

Add the components is your XML File.
1

you can make your owne desing with: progress_layer-xml

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/layer_folien" android:textAppearance="?android:attr/textAppearanceLarge" /> <ProgressBar android:id="@+id/progressBar1" style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/layer_gesamnt" android:textAppearance="?android:attr/textAppearanceLarge" /> <ProgressBar android:id="@+id/progressBar2" style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <Button android:id="@+id/dialog_cancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/layer_button" /> </LinearLayout> 

and de Code to call it

final Dialog dialog = new Dialog(PechaKuchaTimerActivity.this); dialog.show(); final ProgressBar pr_fol = (ProgressBar) dialog.findViewById(R.id.progressBar1); final ProgressBar pr_ges = (ProgressBar) dialog.findViewById(R.id.progressBar2); final Button button_layerCancel = (Button) dialog.findViewById(R.id.dialog_cancel); 

Comments

1

i think you need code here is the one

mydialog.xml

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <Button android:id="@+id/ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Ok" android:layout_gravity="center" /> </LinearLayout> 

.

Dialog dialog=new Dialog(mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.mydialog); dialog.getWindow().getAttributes().width = LayoutParams.FILL_PARENT; dialog.getWindow().setBackgroundDrawableResource(R.drawable.dialogbackground); Button mOkButton=(Button)dialog.findViewById(R.id.ok); mOkButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //do here what you want to do with ok button click } }); 

Here dialogbackground is the background image

1 Comment

@user972890 added in code with dialog.getWindow().setBackgroundDrawableResource(R.drawable.dialogbackground); dialogbackground is the image name in this case

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.