正如标题所说,当我点击图片图块时,我想要加载新活动,但是我希望保持导航栏可见。目前,使用下面的代码,活动开始但导航栏消失。我想帮助编写代码,以便活动开始但导航栏仍然存在。
public class HomeFragment extends Fragment {private ImageView imageCbt;private ImageView imageDistorted;@Nullable@Overridepublic android. view.View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_home, container, false);}@Overridepublic void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); // get the button view imageCbt = getView().findViewById(R.id.whatIsCbt); imageDistorted = getView().findViewById(R.id.distortedThinking); // set a onclick listener for when the button gets clicked imageCbt.setOnClickListener(new View.OnClickListener() { // Start new list activity public void onClick(View v) { Intent mainIntent = new Intent(getActivity(), IntroActivity2.class); startActivity(mainIntent); } }); imageDistorted.setOnClickListener(new View.OnClickListener() { // Start new list activity public void onClick(View v) { Intent mainIntent = new Intent(getActivity(), TwelveTypesDistortedThinkingActivity.class); startActivity(mainIntent); } });}
开满天机
三国纷争
相关分类