admin 管理员组文章数量: 1087139
2023年12月23日发(作者:百度站长工具平台百度站长工具)
activity_代码:
package two;import ntTransaction;import ;import l;import NavigationView;import patActivity;import em;import ew;import ntOne;import ntThree;import ntTwo;public class NavigationActivity extends AppCompatActivity { private TextView mTextMessage; private FragmentOne fragmentOne; private FragmentTwo fragmentTwo; private FragmentThree fragmentThree; private gationItemSelectedListener mOnNavigationItemSelectedListener = new gationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (mId()) { case tion_home: t(_home); showNav(tion_home); return true; case tion_dashboard: t(_dashboard); showNav(tion_dashboard); return true; case tion_notifications: t(_notifications); showNav(tion_notifications); return true; } return false; } }; @Override protected void onCreate(Bundle savedInstanceState) { te(savedInstanceState); setContentView(ty_navigation); init(); mTextMessage = (TextView) findViewById(e); BottomNavigationView navigation = (BottomNavigationView) findViewById(tion); avigationItemSelectedListener(mOnNavigationItemSelectedListener); }
package nt;import nt;import ;import le;import Inflater;import ;import oup;import ew;import two.R;public class FragmentOne extends Fragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view=e(nt_one,container,false); return view; }}FragmentTwo代码:package nt;import nt;import ;import le;import Inflater;import ;import oup;import ew;import two.R;public class FragmentTwo extends Fragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view=e(nt_two,container,false); return view; }}FragmentThree代码:
版权声明:本文标题:使用BottomNavigationActivity实现Android底部导航栏 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1703319092a446738.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论