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());
DialogFragment 对话框 碎片的更多相关文章
- android学习九 对话框碎片
1.android的对话框是异步的,对话框创建后马上执行下面的代码.好处: a.通过实现对话框的回调方法反馈用户与对话框的交互. b.能够在代码中清楚对话框. 2.碎片对话框基 ...
- Android开发 DialogFragment对话框详解
前言 在聊DialogFragment之前,我们看看以往我们在Android里实现一个对话框一般有这几种方式: Dialog 继承重写Dialog实现一个自定义的Dialog AlertDialog ...
- Android 程式开发:(十三)特殊碎片 —— 13.2 DialogFragment
Android 程式开发:(十三)特殊碎片 —— 13.2 DialogFragment 原文地址 我们也可以创建另外一种碎片——DialogFragment.顾名思义,DialogFragment就 ...
- Android_Fragment(碎片)知识点讲解
今天我们来了解下Android 中的fragment(碎片)这个东西. Fragment 从英文翻译而言是碎片,片段的意思.那么这个东西是什么,在Android 中有什么用呢? 一.概念 Fragme ...
- 安卓 Dialogs(对话框)
转载自:http://www.apkbus.com/home.php?mod=space&uid=679028&do=blog&id=61197 对话框是一个小的窗口用以提示用 ...
- Android官方推荐使用DialogFragment替换AlertDialog
DialogFragment是在Android3.0(API level 11)中引入的,它代替了已经不建议使用的AlertDialog. DialogFragment高效地封装和管理对话框的生命周期 ...
- Android开发——官方推荐使用DialogFragment替换AlertDialog
)比如当屏幕旋转时,AlertDialog会消失,更不会保存如EditText上的文字,如果处理不当很可能引发异常,因为Activity销毁前不允许对话框未关闭.而DialogFragment对话框会 ...
- android Fragments介绍
Fragments是Android3.0引入的概念,译为片段.碎片,为了解决不同屏幕分辩率的动态和灵活UI设计. Fragment表现Activity中UI的一个行为或者一部分.可以将多个fragme ...
- Android面试题摘录
本文中面试题全部选自<精通Android>(英文名“Pro android 4”)一书的章后面试题,不过这套面试题与书中内容结合比较紧密,所以选择使用时请谨慎. ####C2:Androi ...
随机推荐
- python 阿狸的进阶之路(4)
装饰器 #1.开放封闭原则:对扩展开放,对修改是封闭#2.装饰器:装饰它人的,器指的是任意可调用对象,现在的场景装饰器->函数,被装饰的对象也是->函数#原则:1.不修改被装饰对象的源代码 ...
- 着色器shaders
着色器(shader)是运行在GPU上的小程序,为图形渲染管线某个特定部分而运行. 着色器也是一种非常独立的程序,它们之间不能相互通信,它们之间唯一沟通只有通过输入输出. GLSL是为图形计算量身定制 ...
- 揭开牙病之谜 与牙医说再见<转>
原贴地址:https://www.douban.com/group/topic/44383918/ -------------------------------------------------- ...
- js Json数组的增删改查
<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title> ...
- Unit 1 overview of IT Industry
Unit 1 overview of IT IndustryConcept LearningIT Industry OutlookThe term technology commonly refers ...
- Spring格式化注解
Spring Framework 3.0发布了.这里我们介绍其中的一个:用于格式化的注解.简介 Spring 3 提供了两个可以用于格式化数字.日期和时间的注解@NumberFormat和@DateT ...
- spring 中AOP的基本知识点
首先AOP就是一个动态代理,主要运用在事务控制,日志记录,安全控制等方面 1.连接点(Joinpoint):一个连接点 总是 代表一个方法的执行. 2.切入点(Pointcut):匹配连接点的 表达式 ...
- C# Excel转换为Json
demo:https://files.cnblogs.com/files/guxingy/Excel%E8%BD%AC%E6%8D%A2%E4%B8%BAJson%E5%AF%B9%E8%B1%A1. ...
- 吴裕雄 python 机器学习-NBYS(1)
import numpy as np def loadDataSet(): postingList=[['my', 'dog', 'has', 'flea', 'problems', 'help', ...
- Oracle中PL/SQL的循环语句
在PL/SQL中可以使用LOOP语句对数据进行循环处理,利用该语句可以循环执行指定的语句序列.常用的LOOP循环语句包含3种形式:基本的LOOP.WHILE...LOOP和FOR...LOOP. LO ...