content: package com.hotapk.fastandrutils.fragment;
  
  
  import android.content.Context;
  import android.os.Bundle;
  import android.support.v4.app.DialogFragment;
  import android.view.Gravity;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  
  import com.hotapk.fastandrutils.R;
  
  import cn.hotapk.fastandrutils.utils.FLogUtils;
  
  public class MyDialogFragment extends DialogFragment {
  
      private int bottom;
      private TextView textView;
  
      public MyDialogFragment() {
          // Required empty public constructor
      }
  
      public static MyDialogFragment newInstance(int bottom) {
          MyDialogFragment fragment = new MyDialogFragment();
          Bundle bundle = new Bundle();
          bundle.putInt("bottom", bottom);
          fragment.setArguments(bundle);
          return fragment;
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setStyle(DialogFragment.STYLE_NORMAL, R.style.lw_menu_style);
  
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          getDialog().getWindow().setGravity(Gravity.TOP);
          View view = inflater.inflate(R.layout.mydialog_fragment, container, false);
          initView(view);
          return view;
      }
  
      private void initView(View view) {
          textView = view.findViewById(R.id.tev);
          LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
          layoutParams.setMargins(0, bottom, 0, 0);
          textView.setLayoutParams(layoutParams);
          FLogUtils.getInstance().e("---+" + bottom);
      }
  
      @Override
      public void onAttach(Context context) {
          super.onAttach(context);
          Bundle arguments = getArguments();
          if (arguments != null) {
              bottom = arguments.getInt("bottom");
          }
  
      }
  }
  