gpt4 book ai didi

android - 如何配置警告对话的标题

转载 作者:塔克拉玛干 更新时间:2023-11-02 18:56:19 25 4
gpt4 key购买 nike

我正在尝试更改标题“输入详细信息”的文本颜色和字体,您可以在下面的快照中看到但未能成功。请帮我解决这个问题。

代码:-

public class MainActivity extends Activity {
Button cust;
Dialog custom;
EditText Fname;
EditText Lname;
TextView txt;
Button savebtn;
Button canbtn;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

cust = (Button)findViewById(R.id.cusdia);
txt = (TextView)findViewById(R.id.txt);
cust.setOnClickListener(new View.OnClickListener()
{
String fname,lname;
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
custom = new Dialog(MainActivity.this);
custom.setContentView(R.layout.dialog);

Fname = (EditText)custom.findViewById(R.id.fname);
Lname = (EditText)custom.findViewById(R.id.lname);
savebtn = (Button)custom.findViewById(R.id.savebtn);
canbtn = (Button)custom.findViewById(R.id.canbtn);
custom.setTitle("Enter Details");

savebtn.setOnClickListener(new View.OnClickListener()
{

@Override
public void onClick(View view) {
// TODO Auto-generated method stub
fname = Fname.getText().toString();
lname = Lname.getText().toString();

txt.setText("Your Name is "+fname +lname);
custom.dismiss();
}

});

警报对话框快照

ALert Dialogue box

最佳答案

style.xml中添加如下代码

<style name="MyDialog" parent="@android:style/Theme.Dialog">

<item name="android:typeface">monospace</item>
<item name="android:textColor">#ff4444</item>

</style>

并像下面这样设置你的对话框

d = new Dialog(Inquiry.this,R.style.MyDialog);

我相信,你会得到你想要的。

关于android - 如何配置警告对话的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26158154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com