多級浮動按鈕(展開與收縮)


多級浮動按鈕(展開與收縮)

  將之前的單個浮動按鈕進行升級

引入的第三方類庫,來實現多級浮動按鈕的特效,同時加上“寫博客”,“寫動態”,“簽到”,這三項功能

  view = inflater.inflate(R.layout.home_fragment, container, false);
        fabTop = view.findViewById(R.id.fab_top);
        tabLayout = view.findViewById(R.id.tablayout);
        viewPager2=view.findViewById(R.id.viewpager);

        //構建展開按鈕屬性
        FabAttributes writeblog = new FabAttributes.Builder()
                .setBackgroundTint(Color.parseColor("#2096F3"))
                .setSrc(getResources().getDrawable(R.drawable.ic_edit))
                .setFabSize(FloatingActionButton.SIZE_AUTO)
                .setPressedTranslationZ(10)
                .setTag(1)
                .build();
        FabAttributes qiandao = new FabAttributes.Builder()
                .setBackgroundTint(Color.parseColor("#FF9800"))
                .setSrc(getResources().getDrawable(R.drawable.qiandao))
                .setFabSize(FloatingActionButton.SIZE_AUTO)
                .setPressedTranslationZ(10)
                .setTag(2)
                .build();
        FabAttributes dongtai = new FabAttributes.Builder()
                .setBackgroundTint(Color.parseColor("#03A9F4"))
                .setSrc(getResources().getDrawable(R.drawable.dongtai))
                .setFabSize(FloatingActionButton.SIZE_AUTO)
                .setPressedTranslationZ(10)
                .setTag(3)
                .build();
//添加菜單
        fabTop.addFab(writeblog, qiandao, dongtai);
        fabTop.setAnimationManager(new FabAlphaAnimate(fabTop));
//設置菜單點擊事件
        fabTop.setFabClickListener(this);

 

 

 

寫動態頁面的編寫

  布局基本完成,選擇多個圖片還未完成,明天的目標就是實現多個圖片的選擇以及上傳到數據庫中。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM