HorizontalScrollMenu


Source link: https://github.com/MorochoRochaDarwin/HorizontalScrollMenu

HorizontalScrollMenu

Es una libreria que permite tener un menu horizontal con scroll, basado en la clase RecyclerView

Capturas de Pantalla

demo 1 demo 2 demo 3
demo 4 demo 5 demo 6

Instalación

importe la libreria a su proyecto android con la opcion "import module" en android studio

Agregar la vista a su Layout

  <com.darwindeveloper.horizontalscrollmenulibrary.custom_views.HorizontalScrollMenuView

android:id="@+id/horizontal_menu"

android:layout_width="match_parent"

android:layout_height="wrap_content"

 />

Diseño completo


<com.darwindeveloper.horizontalscrollmenulibrary.custom_views.HorizontalScrollMenuView

android:id="@+id/horizontal_menu"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:backgroundMenuColor="#d2d2d2"

app:icon_height="70dp"

app:icon_width="70dp"

app:item_backgroundColor="@color/colorPrimary"

app:item_colorSelected="@color/colorAccent"

app:backgroundNotifications="@color/colorAccent"

app:item_marginBottom="4dp"

app:item_marginLeft="4dp"

app:item_marginRight="4dp"

app:item_marginTop="4dp"

app:item_textColor="#ffffff"

app:item_textSize="15sp" />

En sus Actividades o Fragments

Inicialice la vista y capture los eventos clic


  HorizontalScrollMenuView horizontal_menu = (HorizontalScrollMenuView) findViewById(R.id.horizontal_menu);

viewPager = (ViewPager) findViewById(R.id.pager);

  //agregamos los items al menu

horizontal_menu.addItem("Home", R.drawable.home_icon, true);
//este elemento se marcara como seleccionado

horizontal_menu.addItem("Account", R.drawable.round_account);

horizontal_menu.addItem("Message", R.drawable.close_envelope);

horizontal_menu.addItem("Downloads", R.drawable.download);

horizontal_menu.addItem("Calendar", R.drawable.calendarw);

horizontal_menu.addItem("Events", R.drawable.notifications,2);

 horizontal_menu.showItems();
//hacemos visible los items del menu

//implementamos la interface para caputar los clic en el menu

horizontal_menu.setOnHSMenuClickListener(new HorizontalScrollMenuView.OnHSMenuClickListener() {

 @Override

 public void onHSMClick(MenuItem menuItem, int position) {

  Toast.makeText(MainActivity.this, "item " + position, Toast.LENGTH_SHORT).show();

 
}

}
);

Metodos

La clase HorizontalScrollMenuView dispone de los siguientes metodos para facilitar y reducir la codificacion al usuario

Metodo Descripción
void addItem(String text, int icon) agrega un nuevo item al menu (con un texto y un icono)
void addItem(String text, int icon, boolean seleted) agrega un nuevo item al menu (con un texto , un icono y la opcion de marcarlo como seleccionado)
addItem(String text, int icon, boolean seleted, int numNotifications) agrega un nuevo item al menu (con un texto , un icono y la opcion de marcarlo como seleccionado, ademas mostrara un circulo en la parte superior isquierda del icono con un numero)
void addItem(String text, int icon, int numNotifications) agrega un nuevo item al menu (con un texto y un icono, ademas mostrara un circulo en la parte superior isquierda del icono con un numero)
int getItemSeletected() etorna la posicion del item seleccionado en el menu
void editItem(int position, String text, int icon, boolean showNotifications, int numNotifications) edita un item del menu segun su posicion y otros parametros (vea el javadoc para mas informacion)
void showItems() este metodo se debe llamar despues de agregar los items en el menu
void setItemSelected(int position) cambia el item seleccionado del menu
int numItems() retorna el numero de items que tiene el menu

Para mas informacion vea el ejemplo de muestra.

Resources

A simple and flexible library to add carousel view in your android application.

Respectfully request feedback in your Android app.

RxJava wrap around standard Android LocationManager without Google Play Services

A custom view component that mimicks the new Material Design Bottom Navigation pattern.

Spork is an annotation processing library to speed up development on your projects. It allows you to write less boilerplate code to make your code more readable and maintainable.

Utilities for use with RxJava.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes