Commit 8fb78afe by amateur

1

1 parent 872f3b82
package com.polysoft.nafmii.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.whaty.nafmii.R;
public class TestHomeFragment extends Fragment {
public static Fragment newInstance(String value) {
TestHomeFragment fragment = new TestHomeFragment();
Bundle bundle = new Bundle();
bundle.putString("text", value);
fragment.setArguments(bundle);
return fragment;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
super.setHasOptionsMenu(true);
return inflater.inflate(R.layout.test_fragment, null, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
String text = getArguments().getString("text");
TextView tv = view.findViewById(R.id.test_fragment_text);
tv.setText(text);
}
}
......@@ -11,7 +11,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.polysoft.nafmii.enums.ModulesEnum;
import com.polysoft.nafmii.fragment.TestFragment;
import com.polysoft.nafmii.fragment.TestHomeFragment;
import com.whaty.nafmii.R;
import com.polysoft.nafmii.fragment.home.ModulesFragmentMgr;
......@@ -62,10 +62,10 @@ public class TestHomeActivity extends WebviewActivity implements View.OnClickLis
private void initHomeModule() {
int containerId = R.id.home_container_framelayout;
this.mFragmentMap.put(ModulesEnum.HOME, TestFragment.newInstance("首页"));
this.mFragmentMap.put(ModulesEnum.MEMBER, TestFragment.newInstance("会员"));
this.mFragmentMap.put(ModulesEnum.LEARN, TestFragment.newInstance("学习"));
this.mFragmentMap.put(ModulesEnum.MY, TestFragment.newInstance("我的"));
this.mFragmentMap.put(ModulesEnum.HOME, TestHomeFragment.newInstance("首页"));
this.mFragmentMap.put(ModulesEnum.MEMBER, TestHomeFragment.newInstance("会员"));
this.mFragmentMap.put(ModulesEnum.LEARN, TestHomeFragment.newInstance("学习"));
this.mFragmentMap.put(ModulesEnum.MY, TestHomeFragment.newInstance("我的"));
FragmentManager manager = getSupportFragmentManager();
Iterator<ModulesEnum> iterator = this.mFragmentMap.keySet().iterator();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!