All Projects → xiaohaibin → Pagemenulayout

xiaohaibin / Pagemenulayout

Licence: apache-2.0
【Android分页菜单控件】快速实现美团、饿了么、京东、淘宝首页分页菜单效果

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Pagemenulayout

Fillingbutton
🔥Replace typical onLongClickListener with this library!
Stars: ✭ 31 (-84.26%)
Mutual labels:  view, customview
Frames
Retrieves desired frames from video.
Stars: ✭ 51 (-74.11%)
Mutual labels:  view, customview
Textwriter
Animate your texts like never before
Stars: ✭ 140 (-28.93%)
Mutual labels:  view, customview
Zloading
[Android] 这是一个自定义Loading View库。暂停更新
Stars: ✭ 552 (+180.2%)
Mutual labels:  view, customview
Ticketview
🎫 A custom view for showing tickets
Stars: ✭ 101 (-48.73%)
Mutual labels:  view, customview
Cosin
Android loading view library 📊🍭
Stars: ✭ 129 (-34.52%)
Mutual labels:  view, customview
Enviews
🌟A cool dynamic view library
Stars: ✭ 1,771 (+798.98%)
Mutual labels:  view, customview
Movingnumbersview
Moving numbers effect in SwiftUI
Stars: ✭ 175 (-11.17%)
Mutual labels:  view
Sonatapagebundle
This bundle provides a Site and Page management through container and block services
Stars: ✭ 181 (-8.12%)
Mutual labels:  page
Diamond
Diamond is a full-stack web-framework written in The D Programming Language using vibe.d
Stars: ✭ 173 (-12.18%)
Mutual labels:  view
Jxpagingview
类似微博主页、简书主页等效果。多页面嵌套,既可以上下滑动,也可以左右滑动切换页面。支持HeaderView悬浮、支持下拉刷新、上拉加载更多。
Stars: ✭ 2,309 (+1072.08%)
Mutual labels:  page
Transitioner
A library for dynamic view-to-view transitions
Stars: ✭ 2,049 (+940.1%)
Mutual labels:  view
Speedometer
A lightweight circular indicator view library for Android
Stars: ✭ 183 (-7.11%)
Mutual labels:  customview
Searchview
This a view that waiting for network connection to resolve with cool animation .
Stars: ✭ 174 (-11.68%)
Mutual labels:  customview
Swiftconfettiview
Swift Confetti View ! Who doesn't like confetti? 🎉🎉
Stars: ✭ 193 (-2.03%)
Mutual labels:  view
Flipbook Vue
3D page flip effect for Vue.js
Stars: ✭ 170 (-13.71%)
Mutual labels:  page
Epage
一款基于schema的可视化页面配置工具
Stars: ✭ 194 (-1.52%)
Mutual labels:  page
React Native Popover View
A well-tested, adaptable, lightweight <Popover> component for react-native
Stars: ✭ 191 (-3.05%)
Mutual labels:  view
Spannabletextview
SpannableTextView is a custom TextView which lets you customize the styling of slice of your text or statment via Spannables, but without the hassle of having to deal directly with Spannable themselves.
Stars: ✭ 177 (-10.15%)
Mutual labels:  view
View Effects
Apply custom effects on view backgrounds
Stars: ✭ 176 (-10.66%)
Mutual labels:  view

PageMenuLayout

Android分页菜单控件,帮助你快速实现美团、饿了么、京东等分页菜单效果。

最终实现效果

基本使用

1.添加 Gradle 依赖

Jitpack

Add it in your root build.gradle at the end of repositories:

allprojects {
     repositories {
	...
	maven { url 'https://jitpack.io' }
     }
}

Step 2. Add the dependency

dependencies {
   implementation 'com.github.xiaohaibin:PageMenuLayout:latestVersion'//将latestVersion替换成上面 jitpack 后面的版本号
}

2.布局中使用

<?xml version="1.0" encoding="utf-8"?>
    <com.stx.xhb.pagemenulibrary.PageMenuLayout
        android:id="@+id/pagemenu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:pagemenu_row_count="2"
        app:pagemenu_span_count="4"/>

3.代码中使用

  private void initView() {
        entranceIndicatorView = findViewById(R.id.main_home_entrance_indicator);
        mPageMenuLayout = findViewById(R.id.pagemenu);
    }

    //初始化数据
    private void initData() {
        homeEntrances = new ArrayList<>();
        homeEntrances.add(new ModelHomeEntrance("美食", R.mipmap.ic_category_0));
        homeEntrances.add(new ModelHomeEntrance("电影", R.mipmap.ic_category_1));
        homeEntrances.add(new ModelHomeEntrance("酒店住宿", R.mipmap.ic_category_2));
        homeEntrances.add(new ModelHomeEntrance("生活服务", R.mipmap.ic_category_3));
        homeEntrances.add(new ModelHomeEntrance("KTV", R.mipmap.ic_category_4));
        homeEntrances.add(new ModelHomeEntrance("旅游", R.mipmap.ic_category_5));
        homeEntrances.add(new ModelHomeEntrance("学习培训", R.mipmap.ic_category_6));
        homeEntrances.add(new ModelHomeEntrance("汽车服务", R.mipmap.ic_category_7));
        homeEntrances.add(new ModelHomeEntrance("摄影写真", R.mipmap.ic_category_8));
        homeEntrances.add(new ModelHomeEntrance("休闲娱乐", R.mipmap.ic_category_10));
        homeEntrances.add(new ModelHomeEntrance("丽人", R.mipmap.ic_category_11));
        homeEntrances.add(new ModelHomeEntrance("运动健身", R.mipmap.ic_category_12));
        homeEntrances.add(new ModelHomeEntrance("大保健", R.mipmap.ic_category_13));
        homeEntrances.add(new ModelHomeEntrance("团购", R.mipmap.ic_category_14));
        homeEntrances.add(new ModelHomeEntrance("景点", R.mipmap.ic_category_16));
        homeEntrances.add(new ModelHomeEntrance("全部分类", R.mipmap.ic_category_15));
    }

    private void init() {
     
        mPageMenuLayout.setPageDatas(homeEntrances, new PageMenuViewHolderCreator() {
            @Override
            public AbstractHolder createHolder(View itemView) {
                return new AbstractHolder<ModelHomeEntrance>(itemView) {
                    private TextView entranceNameTextView;
                    private ImageView entranceIconImageView;

                    @Override
                    protected void initView(View itemView) {
                        entranceIconImageView = itemView.findViewById(R.id.entrance_image);
                        entranceNameTextView = itemView.findViewById(R.id.entrance_name);
                        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) ((float) ScreenUtil.getScreenWidth() / 4.0f));
                        itemView.setLayoutParams(layoutParams);
                    }

                    @Override
                    public void bindView(RecyclerView.ViewHolder holder, final ModelHomeEntrance data, int pos) {
                        entranceNameTextView.setText(data.getName());
                        entranceIconImageView.setImageResource(data.getImage());
                        holder.itemView.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                Toast.makeText(MainActivity.this, data.getName(), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }
                };
            }

            @Override
            public int getLayoutId() {
                return R.layout.item_home_entrance;
            }
        });
    }

自定义属性说明

属性名 属性说明 属性值
pagemenu_row_count 菜单显示行数 Integer类型,默认为2
pagemenu_span_count 菜单显示列数 Integer类型,默认为5

关于我

Contract

QQ群:271127803

欢迎关注“大话微信”公众号

你的 Statr 是我最大的动力,谢谢~~~

License

Copyright (C) 2016 [email protected]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].