GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Nicky-Li/HorizontalVariableListView: Horizontal list view for Android which allows variable items widths

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
Demo
Demo
 
 
HorizontalVariableListView
HorizontalVariableListView
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 

Repository files navigation

Horizontal Variable ListView

Description

Horizontal list view for Android which allows variable items widths and heights.

Features

  • It extends the AdapterView in order to give the full support to adapters.

  • Customizable left and right edges. A left and right edge glow effect will be shown when the list reaches one of the edges. It can be enabled by setting the overscroll mode to OVER_SCROLL_ALWAYS:

      list.setOverScrollMode( HorizontalVariableListView.OVER_SCROLL_ALWAYS );
    
  • It supports multiple items type. Just override the getViewTypeCount() in your adapter. Each item (by type) can have a different width.

  • It uses a recycler in order to reuse recycled items instead of creating new ones every time.

  • It supports for single/multiple selection using the setSelectionMode method.

Selection

You can control if a single item can be clicked and how it will handle the selected status inside the list.

First, assign the setOnItemClickedListener in this way:

mList.setOnItemClickedListener( new OnItemClickedListener() {

	@Override
	public boolean onItemClick( AdapterView<?> parent, View view, int position, long id ) {
		Log.i( LOG_TAG, "onItemClick: " + position );
		return true;
	}
});

In this way every time an item has clicked, this method will be triggered. If this method will return true then the selection process will continue inside the HorizontalVariableListView, otherwise the event is stopped and.

If the previous method returned a true you will receive a onItemSelected or a onNothingSelected of the onItemSelectedListener. Example:

mList.setOnItemSelectedListener( new OnItemSelectedListener() {

	@Override
	public void onItemSelected( AdapterView<?> parent, View view, int position, long id ) {
			// if you allow multiple selection, then you can
			// query the total selected items:
			int[] positions = mList.getSelectedPositions().length );
		}

		@Override
		public void onNothingSelected( android.widget.AdapterView<?> parent ) {
			// nothing is selected
		};
});

Example

See the Demo MainActivity for a working sample.

License

This software is distributed under the MIT License: http://opensource.org/licenses/MIT


Author Alessandro Crugnola

About

Horizontal list view for Android which allows variable items widths

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.