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?
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.