package safeluck.drive.evaluation.fragment; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import me.yokeyword.fragmentation.SupportFragment; /** * MyApplication2 * Created by lzw on 2019/3/19. 16:55:04 * 邮箱:632393724@qq.com * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class VPFragment extends SupportFragment { public static SupportFragment newInstance(String s){ VPFragment vpFragment = new VPFragment(); Bundle bundle = new Bundle(); bundle.putString("argu",s); vpFragment.setArguments(bundle); return vpFragment; } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { TextView textView = new TextView(_mActivity); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); textView.setGravity(Gravity.CENTER); textView.setLayoutParams(layoutParams); Bundle bundle = getArguments(); if (bundle != null){ textView.setText(bundle.getString("argu")); }else textView.setText("kong"); return textView; } }