package wld.bawei.com.huadong; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; /** * Created by 大金鑫 on 2017/9/11. */ public class Fragmentt extends Fragment{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { Bundle arguments = getArguments(); String name = arguments.getString("args"); TextView textView = new TextView(getActivity()); textView.setText(name); return textView; } public static Fragment getInstance(String title) { Fragmentt fragment0 = new Fragmentt(); Bundle args = new Bundle(); args.putString("args", title); fragment0.setArguments(args); return fragment0; } }
动态创建fragment
最新推荐文章于 2021-05-26 09:00:44 发布