侧拉,传值

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);
    }
}

猜你喜欢

转载自blog.csdn.net/qq_41927301/article/details/79995889