DialogFragment和Interface的使用

这篇博客详细介绍了在Android中如何使用DialogFragment以及与其交互的Interface,通过官方文档解析了多种方法的运用,并展示了从主界面到DialogFragment的实现过程,包括主界面、DialogFragment的显示以及弹框页面的布局设计。
摘要由CSDN通过智能技术生成
android.app.DialogFragment

官方文档,介绍了很多方法的使用:

void	dismiss()
Dismiss the fragment and its dialog.

void	dismissAllowingStateLoss()
Version of dismiss() that uses FragmentTransaction.commitAllowingStateLoss().

Dialog	getDialog()
boolean	getShowsDialog()
Return the current value of setShowsDialog(boolean).

int	getTheme()
boolean	isCancelable()
Return the current value of setCancelable(boolean).

void	onActivityCreated(Bundle savedInstanceState)
Called when the fragment's activity has been created and this fragment's view hierarchy instantiated.

void	onAttach(Context context)
Called when a fragment is first attached to its context.

void	onCancel(DialogInterface dialog)
This method will be invoked when the dialog is canceled.

void	onCreate(Bundle savedInstanceState)
Called to do initial creation of a fragment.

Dialog	onCreateDialog(Bundle savedInstanceState)
Override to build your own custom Dialog container.

void	onDestroyView()
Remove dialog.

void	onDetach()
Called when the fragment is no longer attached to its activity.

void	onDismiss(DialogInterface dialog)
This method will be invoked when the dialog is dismissed.

void	onSaveInstanceState(Bundle outState)
Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted.

void	onStart()
Called when the Fragment is visible to the user.

void	onStop()
Called when the Fragment is no longer started.

void	setCancelable(boolean cancelable)
Control whether the shown Dialog is cancelable.

void	setShowsDialog(boolean showsDialog)
Controls whether this fragment should be shown in a dialog.

void	setStyle(int style, int theme)
Call to customize the basic appearance and behavior of the fragment's dialog.

int	show(FragmentTransaction transaction, String tag)
Display the dialog, adding the fragment using an existing transaction and then committing the transaction.

void	show(FragmentManager manager, String tag)
Display the dialog, adding the fragment to the
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值