• DialogFragment 对话框 碎片



    package
    com.example.m_evolution; import android.app.Dialog; import android.app.DialogFragment; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.view.View; import android.view.WindowManager; import android.widget.SeekBar; import android.widget.TextView; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.concurrent.TimeUnit; import com.melnykov.fab.FloatingActionButton; public class ReplayRecordDialogFragment extends DialogFragment { public static ReplayRecordDialogFragment newInstance(String file_name) { ReplayRecordDialogFragment dialogFragment = new ReplayRecordDialogFragment(); Bundle bundle = new Bundle(); bundle.putString(FILE_NAME, file_name); dialogFragment.setArguments(bundle); return dialogFragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { file_name = getArguments().getString(FILE_NAME); } } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View view = getActivity().getLayoutInflater().inflate(R.layout.fragment_replayrecord, null); builder.setView(view); return builder.create(); } }

    使用起来与Fragment很相像

    在Activity使用时:

    ReplayRecordDialogFragment fragmentReplay = ReplayRecordDialogFragment.newInstance(filename_record);
    fragmentReplay.show(getFragmentManager(), ReplayRecordDialogFragment.class.getSimpleName());
  • 相关阅读:
    (转)kubernetes更新操作详解--kubectl apply
    awk做统计和计算平均值
    kvm虚拟化
    容器(转
    使用python3来实现简易web服务
    12306接口
    python3中的venv环境
    markdown 插入表格
    面向对象编程——类(class)2
    开发纯ndk程序之环境搭配
  • 原文地址:https://www.cnblogs.com/zhaozilongcjiajia/p/10689512.html
Copyright © 2020-2023  润新知