这是我的代码:
<TextView
android:id="@+id/error_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:drawablePadding="5dp"
android:gravity="center"
android:drawableRight="@drawable/error_image"
android:textColor="#aa0000"
android:textStyle="bold"
android:textSize="16dp"/>
我有一个可绘制对象,我想将其设置为不可见,然后当发生错误时可绘制对象出现。我该怎么做?
最佳答案
如果你想隐藏图片就设置0
textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon, 0, 0, 0);
供引用
关于Android:如何设置可绘制对象可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20513315/