我正在使用SweetAlert Dialog for android。
https://github.com/pedant/sweet-alert-dialog
在成功对话框中,我想删除OK按钮并更改其样式。请解释如何删除确定按钮。
我在按钮上点击方法
new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("Good job!")
.setContentText("You clicked the button!")
.show();
答案 0 :(得分:9)
您可以使用简单的策略从甜蜜提醒
访问该按钮SweetAlertDialog alertDialog = new SweetAlertDialog(MainActivity.this,SweetAlertDialog.SUCCESS_TYPE);
alertDialog.setTitleText("Good job!");
alertDialog.setContentText("You clicked the button!");
alertDialog.show();
Button btn = (Button) alertDialog.findViewById(R.id.confirm_button);
btn.setBackgroundColor(ContextCompat.getColor(UserSignupActivity.this,R.color.colorPrimary));
访问后,您可以样式,也可以根据需要隐藏按钮。
答案 1 :(得分:4)
您可以将颜色从color.xml更改为所需的十六进制值;
<color name="blue_btn_bg_pressed_color">#96BFD2</color>
<color name="blue_btn_bg_color">#AEDEF4</color>
<color name="button_text_color">#FFFFFF</color>
<color name="error_stroke_color">#F27474</color>
<color name="float_transparent">#00000000</color>
<color name="gray_btn_bg_color">#D0D0D0</color>
<color name="gray_btn_bg_pressed_color">#B6B6B6</color>
<color name="material_blue_grey_80">#ff37474f</color>
<color name="material_blue_grey_90">#ff263238</color>
<color name="material_blue_grey_95">#ff21272b</color>
<color name="material_deep_teal_20">#ff80cbc4</color>
<color name="material_deep_teal_50">#ff009688</color>
<color name="red_btn_bg_color">#DD6B55</color>
<color name="red_btn_bg_pressed_color">#CD5B55</color>
<color name="success_stroke_color">#A5DC86</color>
<color name="sweet_dialog_bg_color">#FFFFFF</color>
<color name="text_color">#575757</color>
<color name="trans_success_stroke_color">#33A5DC86</color>
<color name="warning_stroke_color">#F8BB86</color>
答案 2 :(得分:1)
尝试此设置可见性已取消OK按钮
SweetAlertDialog sweetdialog = new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("Good job!")
.setContentText("You clicked the button!")
.show();
Button myBtn = (Button) sweetdialog.findViewById(R.id.confirm_button).setVisibility(View.GONE);
答案 3 :(得分:1)
使用以下代码代替new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE)
。
SweetAlertDialog myDialog = new SweetAlertDialog(this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("yourtext")
.setContentText("yourtext2")
.show();
myDialog.findViewById(R.id.confirm_button).setVisibility(View.GONE);
答案 4 :(得分:1)
这也有效
<table>
<tr>
<th>S.NO.</th>
<th>Name</th>
<th>Email</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Phone</th>
<th>Gender</th>
<th colspan="2">Action</th>
<th>Delete</th>
</tr>
<?php
while($row = mysqli_fetch_assoc($result))
{
$srnumber++;
?>
<tr class="<?php echo $row['id']; ?> tablerow">
<td><?php echo $srnumber;?></td>
<td class="<?php echo $row['id'];?> td3"><?php echo $row['name'];?></td>
<td class="<?php echo $row['id'];?> td4"><?php echo $row['email'];?></td>
<td class="<?php echo $row['id'];?> td5"><?php echo $row['address'];?></td>
<td class="<?php echo $row['id'];?> td6"><?php echo $row['city'];?></td>
<td class="<?php echo $row['id'];?> td7"><?php echo $row['state'];?></td>
<td class="<?php echo $row['id'];?> td8"><?php echo $row['phone'];?></td>
<td class="<?php echo $row['id'];?> td9"><?php echo $row['gender'];?></td>
<td><a onclick="userupdateclick(<?php echo $row['id']; ?>);" class="update" data-value="<?php echo $row['id']; ?>">Update</a></td>
<td><a href="#"></a></td>
<td><a onclick="deleteuser(<?php echo $row['id']; ?>);" href="#" class="delete" data-value="<?php echo $row['id']; ?>">Delete</a></td>
</tr>
<tr class="<?php echo $row['id'];?> datavalue" style="display: none;">
<form action="dashboard.php" method="post" id="updateform" class="<?php echo $row['id'];?> formclass">
<td><?php echo $srnumber;?></td>
<td><input type="hidden" name="upid" value="<?php echo $row['id'];?>">
<input type="text" name='upname' id="name" value="<?php echo $row['name'];?>"></td>
<td><input type="text" name='upemail' id="email" value="<?php echo $row['email'];?>"></td>
<td><input type="text" name='upaddress' id="address" value="<?php echo $row['address'];?>"></td>
<td><select name="upcity" id="city">
<option id="blankcity" value="blankcity"></option>
<option value="jalandhar" id="jalandhar" <?php if($row['city']=="jalandhar"){echo 'selected';} ?> >Jalandhar</option>
<option value="chandigarh" id="chandigarh" <?php if($row['city']=="chandigarh"){echo 'selected';} ?> >Chandigarh</option>
<option value="new_chandigarh" id="new_chandigarh" <?php if($row['city']=="new_chandigarh"){echo 'selected';} ?>>New Chandigarh</option>
<option value="panchkula" id="panchkula" <?php if($row['city']=="panchkula"){echo 'selected';} ?> >Panchkula</option>
<option value="sirsa" id="sirsa" <?php if($row['city']=="sirsa"){echo 'selected';} ?> >Sirsa</option>
<option value="mohali" id="mohali" <?php if($row['city']=="mohali"){echo 'selected';} ?> >Mohali</option>
</select></td>
<td><select name="upstate" id="state">
<option id="blankstate" value="blankstate" ></option>
<option value="punjab" id="punjab" <?php if($row['state']=="punjab"){echo 'selected';} ?>>Punjab</option>
<option value="hariyana" id="hariyana" <?php if($row['state']=="hariyana"){echo 'selected';} ?>>Hariyana</option>
<option value="chandigarh" id="schandigarh" <?php if($row['state']=="chandigarh"){echo 'selected';} ?>>Chandigarh</option>
</select></td>
<td><input type="text" name='upphone' id="phone" value="<?php echo $row['phone'];?>"></td>
<td><input type="radio" name="upgender" value="male" id="male" <?php if($row['gender']=='male'){echo 'checked';} ?>>Male
<input type="radio" name="upgender" value="female" id="female" <?php if($row['gender']=='female'){echo 'checked';} ?>>female</td>
<td><a type="button" onclick="usersaveupdate(<?php echo $row['id']; ?>);" href="#" class="saveupdate" data-value="<?php echo $row['id']; ?>"> Save </a></td>
<td><a onclick="usercancelclick(<?php echo $row['id']; ?>);" href="#" class="cancel" data-value="<?php echo $row['id']; ?>">Cancel</a></td>
<td><a onclick="deleteuserform(<?php echo $row['id']; ?>);" href="#" class="delete" data-value="<?php echo $row['id']; ?>">Delete</a></td>
</form>
</tr>
</table>
答案 5 :(得分:0)