Android 如何根据TextView的大小更改BitmapDrawable的大小?
我的版面中有背景图片Android 如何根据TextView的大小更改BitmapDrawable的大小?,android,bitmap,textview,Android,Bitmap,Textview,我的版面中有背景图片TextView,只想对文本应用动画。因此,正如我在中得到的建议: 您可以尝试嵌入一个TextView和 可在FrameLayout中绘制的位图, 然后将动画应用于 文本视图 因此,问题是什么布局应该总是根据TextViewsize更改BitmapDrawable大小?尝试在FrameLayout本身上设置drawable。 框架布局将与文本大小相同,因为包装内容,因此背景也将相同。动画应该只影响图形,而不影响实际布局,因此在设置动画时,这仍然有效 <FrameLayo
TextView
,只想对文本应用动画。因此,正如我在中得到的建议:
您可以尝试嵌入一个TextView和
可在FrameLayout中绘制的位图,
然后将动画应用于
文本视图
因此,问题是什么布局应该总是根据
TextView
size更改BitmapDrawable
大小?尝试在FrameLayout本身上设置drawable。
框架布局将与文本大小相同,因为包装内容,因此背景也将相同。动画应该只影响图形,而不影响实际布局,因此在设置动画时,这仍然有效
<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>