这是MainActivity.java的代码:com.example.jasonwang.fragmenttest;
android.app.Activity;
android.os.Bundle;
android.view.View;
android.widget.Button;
android.widget.TextView;
MainActivity Activity View.OnClickListener {
Button ;
TextView ;
onCreate(Bundle savedInstanceState) {
.onCreate(savedInstanceState);
setContentView(R.layout.);
= (Button) findViewById(R.id.);
= (TextView) findViewById(R.id.);
.setOnClickListener();
}
onClick(View v) {
.setText();
}
}这是MainActivity对应的xml文件代码:<>
</>
</>
</>这是Fragment1.java文件的代码:com.example.jasonwang.fragmenttest;
android.os.Bundle;
;
android.view.LayoutInflater;
android.view.View;
android.view.ViewGroup;
Fragment1 android.support.v4.app.Fragment {
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.,container,);
view;
}
}这是Fragment.java对应的xml文件的代码:<>
</>
</>
添加回答
举报
0/150
提交
取消