Broccoli
Broccoli copied to clipboard
📟An Android library that shows the placeholder of the view.
一点建议
使用发现框架是设置背景颜色,如果View没有设置宽高,则无法显示。 如果需要对View新增默认配置,对项目侵入较大。 建议增加一些params 来配置显示的宽高,若没有设置则使用控件的宽高。
android:background="@color/colorAccent" android:id="@+id/testview" TextView 在xml文件里面设置了背景颜色(一个粉色), broccoli.addPlaceholders(this, R.id.testview); broccoli.show(); Activity里面设置背景,此时TextView背景色变成了框架内默认的 #dddddd。 但在调用broccoli.removeAllPlaceholders()后,TextView的背景颜色还是 默认的#dddddd。 查看源码发现, placeholderPreStateSaver.setRestoredBackgroundDrawable(textView.getBackground()); 存储的是textView原Drawable对象, 随后调用 if (parameter.getColor() != 0){ view.setBackgroundColor(parameter.getColor()); return; } @RemotableViewMethod public void setBackgroundColor(@ColorInt int color) { if...