android-autofittextview
android-autofittextview copied to clipboard
Issue with using inside listview
Hey,
I have used this library.
Its working fine if i am using in any view.
But when i integrate this library with list view. It changing text size randomly.
Let me add my code here, I have added this code inside my list item.
<me.grantland.widget.AutofitTextView
android:id="@+id/tvAudience"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center_vertical"
android:text="Publifhbgdfgdfgfggfgc"
android:maxWidth="@dimen/max_width_targetaudience"
android:singleLine="true"
android:textColor="@color/blue_text" />
Can anyone help me to resolve this issue?
Thanks
This is could possible be due to view recycling. Could you post some ListView + Adapter code that repros this issue?
Bump. Anybody can reproduce it with a simple ListView/RecyclerView and an Adapter.
This happens when you're layout_width
is wrap_content
. Changing it to match_parent
fixed it for me. It has to know how big to be able to draw it. And for some reason after it's recycled, it keeps the old width.
@cranberyxl, thanks a lot! Your solution also helped me :)