简体   繁体   English

文字被截断了?

[英]Text is cut off?

I am trying to show an alert dialog with simply two buttons. 我试图用两个按钮显示一个警告对话框。 However, the text is getting cut off in the second button: 但是,文本在第二个按钮中被切断:

  new AlertDialog.Builder(this)
            .setTitle("THIS IS MY TITLE")
            .setMessage("THIS IS MY MESSAGE")

            .setPositiveButton("Why Cutoff?", null)

            .setNegativeButton("This Shows Fully", null)

            .show();

The positive button is cut off, whereas the negative button shows fully. 正面按钮被切断,而负面按钮则完全显示。 Can I show both buttons? 我可以同时显示两个按钮吗? Maybe by stacking up the buttons on top of each other? 也许通过将按钮堆叠在一起? I just want the user to be able to read my text. 我只是希望用户能够阅读我的文字。

Thanks, 谢谢,

Ruchir Ruchir

Use custom dialog. 使用自定义对话框 Design layout, how you want to show the dialog and buttons and set layout to the dialog like below, 设计布局,如何显示对话框和按钮以及如下设置对话框的布局,

final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.custom);

Checkout this example to implement custom dialog 查看示例以实现自定义对话框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM