material design implement full screen dialog android java

Solutions on MaxInterview for material design implement full screen dialog android java by the best coders in the world

showing results for - "material design implement full screen dialog android java"
Ramsey
18 Aug 2016
1<?xml version="1.0" encoding="utf-8"?>
2<android.support.design.widget.CoordinatorLayout
3xmlns:android="http://schemas.android.com/apk/res/android"
4xmlns:app="http://schemas.android.com/apk/res-auto"
5xmlns:tools="http://schemas.android.com/tools"
6android:layout_width="match_parent"
7android:layout_height="match_parent"
8android:fitsSystemWindows="true">
9
10<android.support.design.widget.AppBarLayout
11    android:layout_width="match_parent"
12    android:layout_height="wrap_content"
13    android:theme="@style/AppTheme.AppBarOverlay">
14
15    <android.support.v7.widget.Toolbar
16        android:id="@+id/toolbar"
17        android:layout_width="match_parent"
18        android:layout_height="?attr/actionBarSize"
19        android:background="?attr/colorPrimary"
20        app:popupTheme="@style/AppTheme.PopupOverlay"/>
21
22</android.support.design.widget.AppBarLayout>
23
24<LinearLayout
25    xmlns:android="http://schemas.android.com/apk/res/android"
26    xmlns:app="http://schemas.android.com/apk/res-auto"
27    xmlns:tools="http://schemas.android.com/tools"
28    android:layout_width="match_parent"
29    android:layout_height="match_parent"
30    android:background="#ffffff"
31    android:orientation="vertical"
32    android:paddingBottom="@dimen/activity_vertical_margin"
33    android:paddingLeft="@dimen/activity_horizontal_margin"
34    android:paddingRight="@dimen/activity_horizontal_margin"
35    android:paddingTop="@dimen/activity_vertical_margin"
36    app:layout_behavior="@string/appbar_scrolling_view_behavior">
37
38    <TextView
39        android:layout_width="wrap_content"
40        android:layout_height="wrap_content"
41        android:text="Your content here"/>
42
43</LinearLayout>
44
45</android.support.design.widget.CoordinatorLayout>
46
Belle
15 Apr 2018
1public class AKDialogFragment extends DialogFragment {
2
3private static final String TAG = "AKDialogFragment";
4
5@Override
6public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
7
8    View rootView = inflater.inflate(R.layout.dialog_ak, container, false);
9
10    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
11    toolbar.setTitle("Dialog title");
12
13    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
14
15    ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
16    if (actionBar != null) {
17        actionBar.setDisplayHomeAsUpEnabled(true);
18        actionBar.setHomeButtonEnabled(true);
19        actionBar.setHomeAsUpIndicator(android.R.drawable.ic_menu_close_clear_cancel);
20    }
21    setHasOptionsMenu(true);
22    return rootView;
23}
24
25@NonNull
26@Override
27public Dialog onCreateDialog(Bundle savedInstanceState) {
28    Dialog dialog = super.onCreateDialog(savedInstanceState);
29    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
30    return dialog;
31}
32
33@Override
34public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
35    menu.clear();
36    getActivity().getMenuInflater().inflate(R.menu.menu_ak, menu);
37}
38
39@Override
40public boolean onOptionsItemSelected(MenuItem item) {
41    int id = item.getItemId();
42
43    if (id == R.id.action_save) {
44        // handle confirmation button click here
45        return true;
46    } else if (id == android.R.id.home) {
47        // handle close button click here
48        dismiss();
49        return true;
50    }
51
52    return super.onOptionsItemSelected(item);
53}
54}
55