Giter Club home page Giter Club logo

expandabletextview's People

Contributors

4xes avatar johnjohndoe avatar manabu-gt avatar shikherverma 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  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

expandabletextview's Issues

expandable textview in listview

How to reset the collapse-state in a listview?
When listview scrolling up and down, the reused textview's height display not right.

Add more views?

Is it possible to add more views in the list item, such as another textview, or a radio button? where these views will be visible on expand and invisible on collapse.
Thank you,

ExpandableTextView inside an ExpandableListView - collapsing problem

I'm trying to get some ExpandableTextView inside an ExpandableListView.

I run into a problem like so:

  1. Expand the ExpandableListView
  2. Expand the ExpandableTextView
  3. Collapse the ExpandableListView
  4. Reopen the ExpandableListView and at first everything seems OK...
  5. Collapse the ExpandableTextView, it doesn't collapse properly

I've prepared a gif

gif

And a git repo to reproduce the problem:

https://github.com/mendhak/expandable-textview-in-expandable-listview-problem

Is there anything I can do to prevent this, maybe some way of forcing the ETV to collapse in the ELV click handler?

maxCollapsedLines not work

when ExpandableTextView parent layout set width 0dp and set weight ,the maxCollapsedLines not work , the text will all show . but when set ExpandableTextView parent layout width "match_parent" and set weight , the maxCollapsedLines work fine .

Can't build with Gradle

I use Intellij Idea for android development. I have not been able to build the app with Gradle. I get this error:
No such property: GROUP for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

a lot /n in text

when user input a lot /n , like
String msg = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\naaaaaa\n\n\n\n\n\n\n\n\n\n\n\n\n\n"

setText(msg, @nonnull SparseBooleanArray collapsedStatus, int position)

it will not work well

Expand/Collapse Bug with recyclerview

testgif
Hi, first of all , awesome library because yours probably is the only one that does this. I am using your library with a recyclerview in my code. I set 3 lines to be displayed in my custom_item
snap 2015-03-13 at 12 50 19

As you saw the issue, some items expand once, the collapse incorrectly and never expand again, any ideas ,if you need any more source files , please let me know, thanks in advance for your help

public class AdapterFeed extends UltimateViewAdapter {
private Context mContext;
private ArrayList mListFeed = new ArrayList<>();
private LayoutInflater mLayoutInflater;
private EventListener mEventListener;
private SparseBooleanArray mTogglePositions = new SparseBooleanArray();

public AdapterFeed(Context context) {
    this.mContext = context;
    mLayoutInflater = LayoutInflater.from(context);
    setHasStableIds(true);
}

public void setFeed(ArrayList<Post> listFeed) {
    if (listFeed != null && listFeed.size() > 0) {
        mListFeed = listFeed;
        notifyItemRangeChanged(0, listFeed.size());
    }
}

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder instanceof HolderFeed) {
        Post currentPost = mListFeed.get(position);
        HolderFeed holderFeed = (HolderFeed) holder;
        holderFeed.textPost.setText(Post.isNotEmptyMessage(currentPost) ? currentPost.getMessage() : "No Text", mTogglePositions, position);

    }
}

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
    View layout = mLayoutInflater.inflate(R.layout.item_feed, viewGroup, false);
    HolderFeed holderFeed = new HolderFeed(layout);
    return holderFeed;
}

@Override
public int getAdapterItemCount() {
    return mListFeed.size();
}


static class HolderFeed extends RecyclerView.ViewHolder {

    private ExpandableTextView textPost;

    public HolderFeed(View itemView) {
        super(itemView);
        textPost = (ExpandableTextView) itemView.findViewById(R.id.expand_text_view);
    }

}

}

the library do not work

compile 'com.ms-square:expandableTextView:0.1.4'

error:
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
6 errors; aborting
Error:Execution failed for task ':app:transformClassesWithDexForOfficialDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Program Files\Java\jdk1.7.0_71\bin\java.exe'' finished with non-zero exit value 1

mCollapsedHeight always 0 , when click to close the ExpandView

The XML Layout is:

<com.ms.square.android.expandabletextview.ExpandableTextView
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
            android:id="@+id/expand_text_view"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            expandableTextView:animDuration="0"
            expandableTextView:maxCollapsedLines="2">

            <TextView
                android:id="@id/expandable_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#666666"
                android:textSize="16sp"/>

            <ImageButton
                android:id="@id/expand_collapse"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right|bottom"
                android:background="@android:color/transparent"
                android:padding="16dp"/>
        </com.ms.square.android.expandabletextview.ExpandableTextView>

in Adapter i do :

`               
private SparseBooleanArray favorList2 = new SparseBooleanArray();
public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) {
...
       threeColumnItemViewHolder.expTv1.setText(stringList.get(2) + stringList.get(2) + stringList.get(2),favorList2,position);
.....
}
`

when i unfold the item the item is Invisible, but when scroll out screen then it visible when it in screen next time

Expand Collapse Icons not visible

when i tried to implement the expandable text-view in a list view The expand and collapse icons are not appearing could you please help me out if i am doing wrong

MyCode: List_rowitem

<!--  ListRow Left sied Thumbnail image -->
<LinearLayout android:id="@+id/thumbnail"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="3dip"
    android:layout_alignParentLeft="true"
    android:background="@android:color/transparent"
    android:layout_marginRight="5dp">

    <ImageView
        android:id="@+id/list_image"
        android:contentDescription="@string/app_name"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@drawable/imagebordercolor"
        />

</LinearLayout>

<!-- Title Of Song-->

<TextView
    android:id="@+id/title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/thumbnail"
    android:layout_toRightOf="@+id/thumbnail"
    android:textColor="@android:color/white"
    android:textSize="15sp"
    android:textStyle="bold"
    android:typeface="sans" />

<!-- Description -->
<com.fiveytechnologies.bhagavadgita.views.ExpandableTextView 
    android:id="@+id/expand_text_view"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/title"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:layout_marginTop="1dip"
    android:layout_toRightOf="@+id/thumbnail"
    expandableTextView:maxCollapsedLines="8"
    expandableTextView:animAlphaStart="1"
    >

   <TextView
        android:id="@id/expandable_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:textSize="12sp"
        android:textColor="@android:color/white" />

    <ImageButton
        android:id="@id/expand_collapse"
        android:contentDescription="@string/app_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="1dp"
        android:layout_gravity="right|bottom"
        android:background="@android:color/transparent"/>


 </com.fiveytechnologies.bhagavadgita.views.ExpandableTextView>





<!-- Rightend Duration -->
<TextView
    android:id="@+id/duration"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignTop="@id/title"
    android:gravity="right"
    android:text="@string/slokacount"
    android:layout_marginRight="5dip"
    android:textSize="12sp"
    android:textColor="#10bcc9"
    android:textStyle="bold"
    android:visibility="gone"
    />

 <!-- Rightend Arrow -->

In the recyclerview, the expansion does not display the entire content correctly.

According to debug, I think that the number of rows that get the textview is incorrect. The number of rows obtained before the super.onMeasure() method is correct (may be 0), but the number of rows obtained after this is less. Up
------------------------------Above from Google Translate, the following is the original----------------------
根据debug,我认为是获取textview的行数不正确导致的,在super.onMeasure()方法之前获取到的行数是正确的(也可能是0),但是在这之后获取到的行数变少了

Hard coded id in XML layout

mTv = (TextView) findViewById(R.id.expandable_text);
mButton = (ImageButton) findViewById(R.id.expand_collapse);

These lines in findViews mean that the id for the children of ExpandableTextView must be expandable_text and expandand_collapse for the TextView and ImageButton respectively.

I initially changed the ids in my XML layout and slammed into a null-pointer exception until i dug into the code. It will nice if this "limitation" is made known to users or better still, remove the hard coded ids. I can submit a pull request to remove the hard coded ids.

Weird behavior

Hi,

If you open the first TextView, then open second one and after that close the first one, the first one won't be expand or collapsed because the onClick doesn't work anymore!

ezgif-1200507821

It have a bug, I don't know why

You can try add a button a your demo project, and on the onClickListener you set the dummy_text2 again. like

    expTv2.setText(getString(R.string.dummy_text2));

    Button bt = (Button) findViewById(R.id.test);

    bt.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            expTv2.setText(getString(R.string.dummy_text2));
        }
    });

after the button clicked, (that is the same text is set again after view created and when textview is collapsed), the textview can't expand fully. I found the mMeasuredTextHeight is a wrong value.

may be I can solve this problem.

thank you for your code.

Rendering problem

java.lang.NoClassDefFoundError: com/ms/square/android/expandabletextview/R$styleable
at com.ms.square.android.expandabletextview.ExpandableTextView.init(ExpandableTextView.java:253)
at com.ms.square.android.expandabletextview.ExpandableTextView.(ExpandableTextView.java:95)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$72(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

How to hide the image button and create custom button?

Hi, I want to remove the image button and add my custom button but it will crash, so I tried to hide the image button but this code is not working android: visibility="gone" . the image button will display even I added this code. So how to hide it?

My custom button just displays a 'Read More' text and no image.

Or I have to create 'read more' image for it? any other solution?

<com.ms.square.android.expandabletextview.ExpandableTextView xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/expand_text_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="30dp"
                    expandableTextView:animDuration="200">

                    <TextView
                        android:id="@id/expandable_text"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textColor="#666666"
                        android:textSize="16sp" />

                    <ImageButton
                        android:id="@id/expand_collapse"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="left|bottom"
                        android:background="@android:color/transparent"
                        android:visibility="gone"
                        android:padding="16dp"
                        android:text="Read More"
                        android:textColor="@color/colorSweat"/>
                </com.ms.square.android.expandabletextview.ExpandableTextView>

One line

When the TextView have just one line to show, the ExpandableTextView let the possibility to be collapsed. And when click the line is cut in half without possibility to expand.

Not able to set android:ellipsize="end"

I added this line in Textview

On first time -> it displays ellipsis at the end of text But After Expand and again on collapse does not display ellipsis .
So it works only for first time.
I am not able to display Ellipsis on collapse of text.

Wrong mCollapsedHeight measured

When I use this view, I found when collapsed, there was no action to collapsed.

After Checking the source code, I put the code:
mCollapsedHeight = getMeasuredHeight();
in to the post method of mTv.

It woks. I am wondering if this is an issue.

Links are not clickable in ExpandableTextView

Setting HTML text as a part of ExpandableTextView using (Html.fromHtml(String, int)) . when there are hyperlinks as a part of HTML content its display as a link. the clicking of that link will collapse the view instead of opening that in browser.
Is the textview which is wrapped in ExpandableTextView (LinearLayout) is
textview.setMovementMethod(LinkMovementMethod.getInstance()); ??

In recycleView can not work well

In a RecyclerView i have other view, if the TextView is expanded and you scroll,the other view in some item has gone please give me some suggestion

After expanding, it does not show last few lines

When we expand textview, it is not showing last few lines because getRealTextViewHeight function is not giving correct textview height.I think it should be called on the right place.Please look into this.

内容显示不全

内容够长的情况下,显示不全,另外给控件设置padding ,margin值会影响内容显示

java.lang.NullPointerException

java.lang.NullPointerException
at com.ms.square.android.expandabletextview.ExpandableTextView.findViews(ExpandableTextView.java:226)
at com.ms.square.android.expandabletextview.ExpandableTextView.onFinishInflate(ExpandableTextView.java:151)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:814)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:688)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:677)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:677)
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:815)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:646)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:589)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:584)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

This error, im using Android Studio & Gradle.

compile 'com.ms-square:expandableTextView:0.1.3'

How to change the dropdown arrow's angle to face right handside.

Hi Awesome library i was searching for accordian kind of similar library and yours kind intriguingly matched my intuition but i need small tweaks on the lib ui like dropdown animation arrow should face right hand side how can i achieve it. and on clicking a title textview i should be able to expand the textview how can i do this. simple example would be i am looking for this
screen shot 2015-11-24 at 2 12 25 pm

Extra blank space when expanded inside RecyclerView

Hi Manabu-GT, I am using a slightly modified version of your library, the only modification I did was to remove the drawable for expand and collapse and replace that with a TextView instead so that it shows Read More and Read Less
testgif

When I expand an item in the RecyclerView and scroll down and come back up, I find it collapsed, I also find extra blank spaces scattered everywhere, am I missing something? Also as per the GIF if you notice, it doesn't expand another time. Thanks for your suggestions in advance

collapse do not work

I checked out your code,and run ,finally found it didn't work(collapse).After debug it ,I found the height is not correct(mCollapsedHeight).here is my solution.

problem code:
if (mCollapsed) { animation = new ExpandCollapseAnimation(this, getHeight(), mCollapsedHeight); } else { animation = new ExpandCollapseAnimation(this, getHeight(), getHeight() + mTextHeightWithMaxLines - mTv.getHeight()); }
//////////////////////////
solution:
if (mCollapsed) { animation = new ExpandCollapseAnimation(this, getHeight(), oldHeight); } else { animation = new ExpandCollapseAnimation(this, getHeight(), getHeight() + mTextHeightWithMaxLines - mTv.getHeight()); oldHeight = getHeight (); }

please add clearAnimation to onAnimationEnd

If you not clearAnimation after textview expand or collapse , the android system will call onMeasure infinite loop.

add clearAnimation to onClick method.

image

thank you.

I don't know if it will cause bug. I have test it and haven't found bug yet.

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.