DialogFragment的使用
来源:互联网 发布:淘宝情趣丝袜女模特 编辑:程序博客网 时间:2024/05/22 13:24
public class EditNameDialogFragment extends DialogFragment { private Button button; private EditText id_txt_your_name; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_edit_name, container); button = view.findViewById(R.id.id_sure_edit_name); id_txt_your_name = view.findViewById(R.id.id_txt_your_name); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { listener.returnRefresh(id_txt_your_name.getText().toString()); } }); return view; } //刷新数据 private static refreshOnDisplayListener listener; public interface refreshOnDisplayListener { public void returnRefresh(String str); } public static void setOnDisplayRefreshListener(refreshOnDisplayListener myListener) { listener = myListener; }}
<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_margin="10dp" android:id="@+id/id_label_your_name" android:layout_width="wrap_content" android:layout_height="32dp" android:gravity="center_vertical" android:text="Your name:" /> <EditText android:layout_marginTop="10dp" android:id="@+id/id_txt_your_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/id_label_your_name" android:imeOptions="actionDone" android:inputType="text" /> <Button android:onClick="onFinish" android:layout_centerHorizontal="true" android:id="@+id/id_sure_edit_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/id_txt_your_name" android:text="ok" /> </RelativeLayout></android.support.v7.widget.CardView>
EditNameDialogFragment.setOnDisplayRefreshListener(new EditNameDialogFragment.refreshOnDisplayListener() { @Override public void returnRefresh(String str) { textview.setText(str); editNameDialog.dismiss(); } });
public void showEditDialog(View view) { editNameDialog = new EditNameDialogFragment(); editNameDialog.show(getSupportFragmentManager(), "EditNameDialog"); }
阅读全文
0 0
- Android:DialogFragment的使用
- ApiDemos--DialogFragment的使用
- DialogFragment的使用示例
- DialogFragment的相关使用
- Dialogfragment的使用
- Android-----DialogFragment的使用
- dialogfragment 的使用
- DialogFragment && NumberPicker的使用
- DialogFragment的使用
- DialogFragment的简单使用
- DialogFragment的使用
- DialogFragment和AlertDialog的使用
- DialogFragment的使用(自定义Dialog )
- Android中DialogFragment的使用
- 使用DialogFragment
- dialogfragment使用
- DialogFragment 使用
- DialogFragment 使用
- UIButton-UIEdgeInsets
- C语言实现进度条彩色变化
- 微信公众号朋友圈压力测试
- 如何禁用win10的数字签名
- 数据对象的强转换
- DialogFragment的使用
- MUI 在上拉加载的容器中手机无法触发click事件
- pandas教程---------DataFrame选择数据(12/4)
- JFRAME的关闭设置
- 学习html总结
- LeetCode--Balanced Binary Tree
- PHP开发中涉及到emoji表情的几种处理方法
- 530. Minimum Absolute Difference in BST
- [自然语言处理] 分享一个工业级NLP工具-SpaCy