以下是文档:
AlertDialog.builder.setView:将自定义视图设置为Dialog的内容.
Dialog.setContentView:将屏幕内容设置为显式视图.
但我仍然有点困惑,任何人都可以更详细地解释它们吗?
解决方法
setView就是这样……设置一个View.所以它可能是ListView,TextView等……
setContentView就像为Activity设置它一样.它设置了完整的布局.根据您使用的setContentView,它可能是父布局或从xml膨胀的布局
setContentView(视图视图)
Set the screen content to an explicit view. This view is placed directly into the screen’s view hierarchy. It can itself be a complex view hierarhcy.
要么
setContentView(int layoutResID)
Set the screen content from a layout resource. The resource will be inflated,adding all top-level views to the screen.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。