android:layout_width=“match_parent”
android:layout_height=“0dp”
android:layout_weight=“1.0” >
3.2 底部带的三个图标
<com.demo.test.view.NestedRadioGroup
android:id="@+id/rg_main_tabbar"
style="@style/Bottom.MainTabBar" >
<FrameLayout
android:layout_width=“0dp”
android:layout_height=“match_parent”
android:layout_weight=“1.0” >
<RadioButton
android:id="@+id/rb_new_msg"
style="@style/Bottom.MainTabBar.NestedButton"
android:button="@null"
android:drawableTop="@drawable/selector_main_tabbar_newmsg"
android:checked=“true”
android:text=“消息” />
<RadioButton
android:id="@+id/rb_index"
style="@style/Bottom.MainTabBar.Button"
android:button="@null"
android:drawableTop="@drawable/selector_main_tabbar_index"
android:text=“首页” />
<RadioButton
android:id="@+id/rb_profile"
style="@style/Bottom.MainTabBar.Button"
android:button="@null"
android:drawableTop="@drawable/selector_main_tabbar_profile"
android:text=“个人” />
</com.demo.test.view.NestedRadioGroup>
4.selector_main_tabbar_newmsg.xml
代码如下:
5.MainActivity.java
中代码如下,我不说多,直接理解就可以
…
private Fragment newMsgFragment;
private Fragment indexFragment;
private Fragment profileFragment;
…
public void init(){
newMsgFragment=new NewMsgFragment();
FragmentTransaction transaction=getFragmentManager().beginTransaction();
transaction.add(R.id.container, newMsgFragment, “newMsgFragment”);
transaction.addToBackStack(“newMsgFragment”);
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
transaction.commit();
NestedRadioGroup tabBarRg=(NestedRadioGroup) findViewById(R.id.rg_main_tabbar);
tabBarRg.setOnCheckedChangeListener(new NestedRadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(NestedRadioGroup group, int checkedId) {
总结
Android架构学习进阶是一条漫长而艰苦的道路,不能靠一时激情,更不是熬几天几夜就能学好的,必须养成平时努力学习的习惯。所以:贵在坚持!
上面分享的字节跳动公司2021年的面试真题解析大全,笔者还把一线互联网企业主流面试技术要点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节。
【Android学习PDF+学习视频+面试文档+知识点笔记】
【Android高级架构视频学习资源】
4%BC%9A%E8%BF%99%E4%BA%9B%EF%BC%9F%E5%A6%82%E4%BD%95%E9%9D%A2%E8%AF%95%E6%8B%BF%E9%AB%98%E8%96%AA%EF%BC%81.md)】
【Android高级架构视频学习资源】
Android部分精讲视频领取学习后更加是如虎添翼!进军BATJ大厂等(备战)!现在都说互联网寒冬,其实无非就是你上错了车,且穿的少(技能),要是你上对车,自身技术能力够强,公司换掉的代价大,怎么可能会被裁掉,都是淘汰末端的业务Curd而已!现如今市场上初级程序员泛滥,这套教程针对Android开发工程师1-6年的人员、正处于瓶颈期,想要年后突破自己涨薪的,进阶Android中高级、架构师对你更是如鱼得水,赶快领取吧!