package zhanghaijiao.bawei.com.day06_demo3;
import android.os.Bundle;
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 org.w3c.dom.Text;
/**
* Created by jane on 2018/4/18.
*/
public class ContentFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.f1,container,false);
TextView textView=v.findViewById(R.id.tv);
//获取数据并显示
Bundle arguments = getArguments();
if(arguments!=null){
String key = arguments.getString("key");
textView.setText(key);
}
return v;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
}
import android.os.Bundle;
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 org.w3c.dom.Text;
/**
* Created by jane on 2018/4/18.
*/
public class ContentFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.f1,container,false);
TextView textView=v.findViewById(R.id.tv);
//获取数据并显示
Bundle arguments = getArguments();
if(arguments!=null){
String key = arguments.getString("key");
textView.setText(key);
}
return v;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
}