Reputation: 20429
I have TextView
with background picture in my layout and would like to apply an animation to the text only. So, as I was advised in the separate question:
you could try embedding a TextView and a BitmapDrawable in a FrameLayout, then apply the animation to the TextView.
So, the question is what should be the layout that BitmapDrawable
size would be changed in accordance with TextView
size always?
Upvotes: 0
Views: 522
Reputation: 2910
Try setting the drawable on the FrameLayout itself. The FrameLayout will be the same size as the text, because of wrap_content, and so the background will be as well. The animation should only affect the drawing, not the actual layout, so this should still work when you animate it.
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/your_background">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World" />
</FrameLayout>
Upvotes: 1