Giter Club home page Giter Club logo

expandableheightlistview's Introduction

ExpandableHeightListView

Android Library to put a ListView inside a ScrollView without collapsing.

Maven Central Android Arsenal

How to use

Add this to your build.gradle:

repositories {
    mavenCentral()
}

dependencies {
  compile 'com.github.paolorotolo:expandableheightlistview:1.0.0'
}

Add ExpandableHeightListView instead of ListView in your xml files:

<ScrollView 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">

        <com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView
            android:id="@+id/expandable_listview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="8dp">
        </com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView>
</ScrollView>

Expand ExpandableHeightListView programmatically:

    ExpandableHeightListView expandableListView = (ExpandableHeightListView) findViewById(R.id.expandable_listview);
    
    expandableListView.setAdapter(adapterName);

    // This actually does the magic
    expandableListView.setExpanded(true);

It also works well with GridView.

Just use this instead:

<com.github.paolorotolo.expandableheightlistview.ExpandableHeightGridView
            android:id="@+id/expandable_listview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="8dp">
        </com.github.paolorotolo.expandableheightlistview.ExpandableHeightGridView>

Example

See it in action: download test .apk here.

Also check the example app's sources here on GitHub (ExpandableHeightListViewExample).

##Wait, what? Well, did you ever try to put a ListView inside a ScrollView?

This is what happens.

And this is what you can do with ExpandableHeightListView.

Inspired by this answer on StackOverflow.

expandableheightlistview's People

Contributors

paolorotolo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

expandableheightlistview's Issues

Maven Link issue

On Maven, Version 1.1.0 seems to be pointing at the wrong project.

See ExpandableHeightListView's Maven listing here.

Its XML shows:
<name>ExpandableHeightListView</name> <description>AppIntro library</description> <url>https://github.com/PaoloRotolo/appintro</url>

And my imports can't find anything besides AppIntro:
screen shot 2016-08-11 at 5 34 09 pm

How to add swipe to left option in it

I have tried to add the swipe to left option in it but the swipe option doesn't works and i have tried the same in ordinary listview there it works.can u tell me why the swipe to left option works in expandable height listview

when i set divider height the list is collapsing.

when i set the divider height the list is collapsing to its default size. can you please tell me how to set divider height in custom adapter. and i also tried in default adapter given in your example the result is same.
following code :
ExpandableHeightListView expandableListView = (ExpandableHeightListView) findViewById(R.id.expandable_listview);

expandableListView.setAdapter(adapterName);

expandableListView.setDividerHeight(20); // causing the problem
expandableListView.setExpanded(true);

Crash on ExpandableTextView.java on line- 309

This crash on the specific device model like- LGE(Nexus 4)
Please resolve this issue -.

Caused by android.view.InflateException: Binary XML file line #32: Binary XML file line #32: Error inflating class com.ms.square.android.expandabletextview.ExpandableTextView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView
(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at w3bminds.engVarta.app.Activities.MGB.MGBActivity.onCreate(MGBActivity.java:47)
at android.app.Activity.performCreate(Activity.java:6280)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1116)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2479)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5421)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.