CompoundDrawable size

后端 未结 6 2041
臣服心动
臣服心动 2020-12-08 14:32

Android-Lint gives me this hint in some cases:

This tag and its children can be replaced by one and a compound drawable

I cou

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 15:10

    @Oleksandr answer is the best one especially if your are going to change the Drawable programmatically, but you should add :

        @Override
    public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end, int bottom) {
        super.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
        initCompoundDrawableSize();
    

    }

    so it will Re-Calculate whenever Coumpounds is changed.

提交回复
热议问题