import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.myapplication.R; import butterknife.BindView; import butterknife.ButterKnife; /** * @author:created By ZhangHao * 时间:2019/5/7 18 * 邮箱:188660586@qq.com */ public class HistoryContentFragment extends Fragment { @BindView(R.id.tv_content) TextView tvContent; private String title; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle=getArguments(); title=bundle.getString("titles"); if(title==null){ title="参数非法"; } } @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view= inflater.inflate(R.layout.fragment_history_content,container,false); ButterKnife.bind(this,view); tvContent.setText(title); return view; } }