Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <activity
- android:name="Activity"
- android:theme="@style/customDialog" />
- <style name="customDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
- <item name="windowNoTitle">true</item>
- <item name="colorAccent">@color/colorPrimary</item>
- <item name="android:textColorPrimary">@color/colorNegro</item>
- <item name="android:windowBackground">@android:color/transparent</item>
- </style>
- public class CustomDialog extends Dialog {
- Button button;
- TextView textview;
- private View view;
- public CustomDialog (Context context, Activity activity, String message, String text_button){
- super(context);
- view = LayoutInflater.from(context).inflate(R.layout.custom_dialog, null);
- getWindow().setBackgroundDrawable(context.getResources().getDrawable(R.drawable.transparent_back));
- setContentView(view);
- button = (Button) view.findViewById(R.id.button);
- textview = (TextView) view.findViewById(R.id.textview);
- setDataOnWidgets(message,text_button);
- }
- public void setDataOnWidgets(String message, String text_button){
- textview.setText(message);
- button.setText(text_button);
- }
- public void setButton(View.OnClickListener listener){
- button.setOnClickListener(listener);
- }
- final CustomDialog dialog = new CustomDialog(
- Activity.this,
- Activity.this,
- message,
- text_button);
- alert.setCancelable(false);
- alert.setButton(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- }
- });
- alert.show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement