title: Display Snackbar without CoordinatorLayout
body: <p>I have Displayed Snackbar using CoordinatorLayout but in some layout i did't used CoordinatorLayout layout and i want to display snackbar but faced problem with it.</p>
  
  <p>I have tried following way to achieve snackbar without CoordinatorLayout but it will display following result.</p>
  
  <pre><code>Snackbar.make(getActivity().getWindow().getDecorView().getRootView(), "Testing Snackbar", Snackbar.LENGTH_LONG).show();
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/83BlM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/83BlM.png" alt="enter image description here"></a></p>
  
  <p>Test it with android 8.0 Oreo</p>
  
  <p>Is there any way to achieve Snackbar without CoordinatorLayout?</p>
  
  <p>Thanks in advance.</p>
  
  <p>code</p>
  
  <pre><code>public class FirstFragment extends Fragment {
  
  RelativeLayout rootView;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_first, container, false);
  
          Log.e("onCreateView", "onCreateView");
  
          rootView = (RelativeLayout)view.findViewById(R.id.rootView);
          setSnackBar(rootView, "Testing with answered");
          return view;
      }
  
  public static void setSnackBar(View coordinatorLayout, String snackTitle) {
          Snackbar snackbar = Snackbar.make(coordinatorLayout, snackTitle, Snackbar.LENGTH_SHORT);
          snackbar.show();
          View view = snackbar.getView();
          TextView txtv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
          txtv.setGravity(Gravity.CENTER_HORIZONTAL);
      }
  }
  </code></pre>