kyosherlock / expandablelayout Goto Github PK
View Code? Open in Web Editor NEWExpandableLayout for Android
ExpandableLayout for Android
I us library to create ExpandableTextView for RecyclerView items, but there is something wrong when I open item and then scroll up - items, which has less then 4 lines (ExpandableTextView expands on >4 lines) become very height.
My screenshots:
Normal item
After opening another item and scrolling up to this item
Do you have an example with recycle view??
I am using a RecyclerView to show some elements and comparing to your sample I don't see the error. The adapter, that I am using, has some layouts inside it and when I expand the textView I defined as expandable it shows this text perfectly, but the rest elements are compressed... This is my xml:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/layout_top_timeline" />
<include layout="@layout/layout_middle_timeline" />
<include layout="@layout/layout_bottom_timeline" />
<TextView
android:id="@+id/description_video"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="14dp"
android:layout_weight="0.13"
android:text="@string/txt_timeline"
android:textColor="#484b4c"
android:textSize="14sp" />
<com.kyo.expandablelayout.ExpandableLayout
android:id="@+id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/description_expanded"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="14dp"
android:text="@string/txt_timeline"
android:textColor="#484b4c"
android:textSize="14sp"
app:canExpand="true" />
</com.kyo.expandablelayout.ExpandableLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/line_separator_tab" />
<TextView
android:id="@+id/bt_view_all"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:background="@null"
android:gravity="center"
android:scaleType="fitCenter"
android:text="View all" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/line_separator_tab" />
</LinearLayout>
<FrameLayout
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginLeft="14dp"
android:layout_marginTop="9dp">
<ImageView
android:id="@+id/iv_user_picture"
android:layout_width="64dp"
android:layout_height="64dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/icon_profile_picture_placeholder"
app:srcCompat="@drawable/icon_profile_picture_placeholder" />
<ImageView
android:id="@+id/iv_reaction_emoji"
android:layout_width="@dimen/default_icon_button"
android:layout_height="@dimen/default_icon_button"
android:contentDescription="@string/cd_reaction_face"
android:scaleType="fitXY" />
</FrameLayout>
In java there is nothing special to show... I only call toggleExpansion() to do it. Using weights in your sample it works perfectly, but not in my case...Thanks
Is there a reason the minSdkVersion is on 15?
I've tried changing it to 14, and everything seems fine. I might have missed some 15 and up code, so that's why I'm asking ๐
Hello Sherlock.jiang,
This article is really nice, When I tried this for my app in debugg build it is working fine, But in release build its not expanding. I am using in recycle view. Please review code as below.
Please help on this what i am doing wrong.
Thanks in advance,
Guru.
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dimen_five_dp"
card_view:cardBackgroundColor="@color/white_color"
card_view:cardCornerRadius="@dimen/dimen_four_dp"
card_view:cardElevation="@dimen/dimen_two_dp">
<com.kyo.expandablelayout.ExpandableLayout
android:id="@+id/expandablelayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/dimen_ten_dp"
android:paddingTop="@dimen/dimen_ten_dp"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:canExpand="true">
</LinearLayout>
</com.kyo.expandablelayout.ExpandableLayout>
</android.support.v7.widget.CardView>
Hi,
This library stop working if I build my app within proguard. Could you have try please?
It is not a issue , it's an enhancement actually, I want to set RecyclerView layout manager as GridLayoutManager but than if I expand a item of RecyclerView it should expand to device's screen full width
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.