2024年最全安卓左右滑动框架——纯手写,不用依赖别人的框架啦(1),移动客户端开发面经

推荐学习资料


  • 脑图
    360°全方位性能调优

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

tv_set.setTextColor(0xff1B940A);

viewPager.setCurrentItem(4);

default:

break;

}

}

private void restartBotton() {

// TextView置为白色

tv_home.setTextColor(0xffffffff);

tv_address.setTextColor(0xffffffff);

tv_friend.setTextColor(0xffffffff);

tv_setting.setTextColor(0xffffffff);

tv_set.setTextColor(0xffffffff);

}

@Override

public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

}

@Override

public void onPageSelected(int position) {

restartBotton();

//当前view被选择的时候,改变底部菜单图片,文字颜色

switch (position) {

case 0:

tv_home.setTextColor(0xff1B940A);

break;

case 1:

tv_address.setTextColor(0xff1B940A);

break;

case 2:

tv_friend.setTextColor(0xff1B940A);

break;

case 3:

tv_setting.setTextColor(0xff1B940A);

break;

case 4:

tv_set.setTextColor(0xff1B940A);

break;

default:

break;

}

}

@Override

public void onPageScrollStateChanged(int state) {

}

}

有报红的先不用理它。

(2)activity_home.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

tools:context=“com.example.myclient.HomeActivity”>

<LinearLayout

android:layout_width=“wrap_content”

android:layout_height=“match_parent”

android:gravity=“center”

android:orientation=“vertical”>

<androidx.viewpager.widget.ViewPager

android:id=“@+id/vp_content”

android:layout_width=“match_parent”

android:background=“#ffffff”

android:layout_height=“0dp”

android:layout_weight=“1” >

</androidx.viewpager.widget.ViewPager>

(3)activity_bottom.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“35dp”

android:background=“#CBB4F5” >

<LinearLayout

android:id=“@+id/ll_home”

android:layout_width=“0dp”

android:layout_height=“wrap_content”

android:layout_weight=“1”

android:gravity=“center”

android:orientation=“vertical” >

<ImageView

android:id=“@+id/iv_home”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

/>

<TextView

android:id=“@+id/tv_home”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:text=“页面1”

android:textSize=“20dp”

android:textColor=“#1B940A”

android:textStyle=“bold” />

<LinearLayout

android:id=“@+id/ll_address”

android:layout_width=“0dp”

android:layout_height=“wrap_content”

android:layout_weight=“1”

android:gravity=“center”

android:orientation=“vertical” >

<ImageView

android:id=“@+id/iv_address”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

/>

<TextView

android:id=“@+id/tv_address”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:text=“页面2”

android:textColor=“#ffffff”

android:textSize=“20dp”

android:textStyle=“bold” />

<LinearLayout

android:id=“@+id/ll_friend”

android:layout_width=“0dp”

android:layout_height=“wrap_content”

android:layout_weight=“1”

android:gravity=“center”

android:orientation=“vertical” >

<ImageView

android:id=“@+id/iv_friend”

android:layout_width=“53dp”

android:layout_height=“match_parent”

/>

<TextView

android:id=“@+id/tv_friend”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:text=“页面3”

android:textSize=“20dp”

android:textColor=“#ffffff”

android:textStyle=“bold” />

<LinearLayout

android:id=“@+id/ll_setting”

android:layout_width=“0dp”

android:layout_height=“wrap_content”

android:layout_weight=“1”

android:gravity=“center”

android:orientation=“vertical” >

<ImageView

android:id=“@+id/iv_setting”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

/>

<TextView

android:id=“@+id/tv_setting”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:text=“页面4”

android:textColor=“#ffffff”

android:textSize=“20dp”

android:textStyle=“bold” />

<LinearLayout

android:id=“@+id/ll_set”

android:layout_width=“0dp”

android:layout_height=“wrap_content”

android:layout_weight=“1”

android:gravity=“center”

android:orientation=“vertical” >

<ImageView

android:id=“@+id/iv_set”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

/>

<TextView

android:id=“@+id/tv_set”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:text=“页面5”

android:textColor=“#ffffff”

android:textSize=“20dp”

android:textStyle=“bold” />

(4)回到HomeActivity.java,会看到ContentAdapter报红,这里新建一个ContentAdapter.java类

public class ContentAdapter extends PagerAdapter {

private List views;

public ContentAdapter(List views) {

this.views = views;

}

@Override

public int getCount() {

return views.size();

}

@Override

public boolean isViewFromObject(View arg0, Object arg1) {

return arg0 == arg1;

}

@Override

public Object instantiateItem(ViewGroup container, int position) {

View view = views.get(position);

container.addView(view);

return view;

}

@Override

public void destroyItem(ViewGroup container, int position, Object object) {

container.removeView(views.get(position));

}

}

(5)page_01~05的报红,新建5个Layout resource file(xml),分别命名为page_01.xml、page_02.xml…以此类推

page_01.xml的内容和其他的有点点不同,因为嵌入fragment会让APP更灵活方便。

以下是page_01.xml代码:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”

android:orientation=“vertical”

android:layout_gravity=“center”

android:gravity=“center”

android:layout_width=“match_parent”

android:layout_height=“match_parent”>

<fragment

android:id=“@+id/test”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:name=“com.example.myclient.TestFragment”

/>

TestFragment报红了是不是?

新建一个TestFragment.java,包名先不用管。

public class TestFragment extends Fragment {

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

最后

总之啊,家里没矿的同学们,如果你们想以后的日子过得好一些,多想想你们的业余时间怎么安排吧;

技术方面的提升肯定是重中之重,但是技术外的一些“软实力”也不能完全忽视,很多时候升职确实是因为你的技术足够强,但也与你的“软实力”密切相关

在这我也分享一份大佬自己收录整理的 Android学习PDF+架构视频+面试文档+源码笔记 ,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料这些都是我闲暇还会反复翻阅并给下属员工学习的精品资料。在脑图中,每个知识点专题都配有相对应的实战项目,可以有效的帮助大家掌握知识点。

总之也是在这里帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习

相信自己,没有做不到的,只有想不到的

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

升肯定是重中之重,但是技术外的一些“软实力”也不能完全忽视,很多时候升职确实是因为你的技术足够强,但也与你的“软实力”密切相关

在这我也分享一份大佬自己收录整理的 Android学习PDF+架构视频+面试文档+源码笔记 ,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料这些都是我闲暇还会反复翻阅并给下属员工学习的精品资料。在脑图中,每个知识点专题都配有相对应的实战项目,可以有效的帮助大家掌握知识点。

总之也是在这里帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习

[外链图片转存中…(img-mGJhsT4d-1715126703996)]

[外链图片转存中…(img-WcgC6vad-1715126703996)]

相信自己,没有做不到的,只有想不到的

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 21
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值