Comments (7)
Hi Tomas
thanks for reporting this issue! If you want a quick fix for your problem, use android:maxLines="4" in your layout file instead of using expandText.setMaxLines(4); in your Activity / Fragment.
I'll add support for also using the setMaxLines() method.
Good luck!
from android-expandabletextview.
Hi Michael
thanks for reporting this issue!
Can you provide me your layout file and a code snippet from your Fragment / Activity? I'll try to reproduce the issue on my side and help you out asap.
Thanks again!
Cliff
from android-expandabletextview.
Hi Michael
did you already find some time to check my previous questions to you?
Thanks!
Cliff
from android-expandabletextview.
I have set max lines 4. On first load I have 4 lines. I click on the text, it expands. Than I click to collapse, it collapses to 4 and than expands back. Than if I click again nothing happens. Text stays expanded.
expandText.setInterpolator(new OvershootInterpolator()); expandText.setMaxLines(4); expandText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(expandText.isExpanded()){ expandText.collapse(); } else{ expandText.expand(); } } });
Layout is a bit stripped down..
`
<TextView
android:id="@+id/anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:minHeight="?attr/actionBarSize"/>
<android.support.percent.PercentRelativeLayout
android:id="@+id/detailWrapper"
android:layout_below="@+id/anchor"
android:layout_centerInParent="true"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="20dp">
<RelativeLayout
android:id="@+id/detailContainer"
android:layout_alignParentLeft="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_widthPercent="95%">
<LinearLayout
android:id="@+id/sponsorLogoContainer"
...
</LinearLayout>
...
<TextView
android:id="@+id/title"
android:layout_below="@id/thumbnail"
.../>
<TextView
android:id="@+id/episodeIndex"
android:layout_below="@id/title"
.../>
<at.blogc.android.views.ExpandableTextView
android:id="@+id/subtitle"
android:layout_below="@id/episodeIndex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="@dimen/detail_title_margin"
android:layout_marginRight="@dimen/detail_title_margin_right"
android:text="Subtitle text"
android:textSize="@dimen/detail_subtitle_size" />
<LinearLayout
android:id="@+id/buttonsWrapper"
android:layout_below="@id/subtitle"
...
</LinearLayout>
...
</RelativeLayout>
</android.support.percent.PercentRelativeLayout>
</RelativeLayout>
`
How ever, I used a different approach at the end and I don't have the orig element, but this is the fragment layout where I used the ExpandableTextView. Now I is just a simple TextView, just renamned that one so you can see where it was originally. Same thing happen to me as mentioned above.
Hope it helps...
from android-expandabletextview.
how to use this textview in listview in listitem row with simpleAdapter?
from android-expandabletextview.
Setting MaxLines in code is crucial for XML-free Kotlin's anko layouts...
from android-expandabletextview.
I've made a forked version of this library that allows setting the max lines in code: https://github.com/zacharee/Android-ExpandableTextView.
Here's the relevant commit: zacharee@5fc91d3
I just changed any calls to setMaxLines()
inside the ExpandableTextView class to call the super method, and then overrode both setMaxLines()
and getMaxLines()
to properly set and report ExpandableTextView's maxLines
field.
from android-expandabletextview.
Related Issues (20)
- Android 8 issue HOT 11
- Extras \n\n on expand HOT 3
- unable to set setOnExpandListener HOT 2
- 1.1.0 HOT 10
- toggling in the middle of an animation HOT 1
- Duration consideration with variable lines HOT 1
- OvershootInterpolator issue HOT 1
- Facing issue while using custom fonts. HOT 5
- For Expandablelistview with JSON data HOT 1
- Dynamic edittext id in android
- Odd layout with gravity="center" and ellipsize="end" HOT 1
- How to set Text Alignment Justified for the text ? HOT 1
- How determine if need expand the text? HOT 1
- A way to cache the views after adding?
- ExpandableTextView does not work with the Spannable String
- How can I use this with RecyclerView
- `ExnpandableTextView` doesn't maintain expanded state changes between orientation/config changes HOT 1
- how to remove animation?
- Don't work well in recyclerview
- To Add Custom Expand / Collapse Text
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-expandabletextview.