[英]How to change size of BitmapDrawable in accordance with size of TextView?
我的布局中有带有背景图片的TextView
,并且想仅将 animation 应用于文本。 因此,正如我在单独的问题中所建议的那样:
您可以尝试在 FrameLayout 中嵌入 TextView 和 BitmapDrawable,然后将 animation 应用于 TextView。
那么,问题是, TextView
BitmapDrawable
大小而改变的布局应该是什么?
尝试在 FrameLayout 本身上设置可绘制对象。 由于 wrap_content,FrameLayout 将与文本大小相同,因此背景也是如此。 animation 应该只影响绘图,而不是实际布局,所以当你为它设置动画时它应该仍然有效。
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.