android - 使用 drawableLeft 将动画应用于 Drawable 集

标签 android android-animation android-view textview android-drawable

我将图标设置为 android:drawableLeftTextView

我想对那个 Drawable 应用一些外观更改和一些方法。 因为我没有它的 ID,所以我无法操纵它的外观。

请告诉我如何获取它的 ID,以便我以某种方式获得它的对象?

最佳答案

Just let me know how to get it's id.

我假设,通过说您希望收到 View 的 ID,然后在该 View 上执行动画。但是,如您所知,TextViewView 的后代,不是 ViewGroup,因此不可能TextView 来组合多个 View。相反,TextView 布置了一个 Drawable 实例。

你可以得到 Drawableperform animations on that Drawable直接。

getCompoundDrawables()将返回 Drawable[] 数组,其中填充了左侧、顶部、右侧和底部的 Drawable

关于android - 使用 drawableLeft 将动画应用于 Drawable 集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43819210/

相关文章:

安卓性能 : Adding view programmatically vs setting view to GONE/VISIBLE

java - GCM 推送通知不起作用,并且注册 ID 也不显示

android - 向上操作后的返回键行为

android - ICS 中类似 Gmail 的 View

android - 仅在 View 的 (1/4) 部分设置背景颜色 (Android)

android-jetpack-compose - 如何在不自动滚动更改的情况下使用 LazyColumn animateItemPlacement()?

java - 当服务被杀死时销毁前台通知

android - 根据 ListFragment 中可见项的数量更改 ActionBar 中的操作

android - 添加一个 AnimationDrawable 到 BottomNavigationView

android - 在Android上对FloatingActionButton图像进行动画更改