whataa / nodrawable Goto Github PK
View Code? Open in Web Editor NEW一个旨在减少99%的drawable.xml文件的库,可直接在布局文件中对任意View声明drawable属性。
License: Apache License 2.0
一个旨在减少99%的drawable.xml文件的库,可直接在布局文件中对任意View声明drawable属性。
License: Apache License 2.0
可以在xml布局中实时看到效果吗?
我想在RecyclerView的item中的布局使用drawable,但是发现没有效果还报错
Cannot find the setter for attribute 'drawable_shapeMode' with parameter type int on android.widget.TextView.
可否举个例子
Process: com.dreamfair.dreamfair, PID: 5471
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
at androidx.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1211)
at androidx.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1268)
at androidx.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1268)
at androidx.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1268)
at androidx.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1268)
at androidx.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:1268)
at androidx.databinding.ViewDataBinding.mapBindings(ViewDataBinding.java:719)
at com.dreamfair.dreamfair.databinding.FragmentMainBindingImpl.(FragmentMainBindingImpl.java:29)
at com.dreamfair.dreamfair.DataBinderMapperImpl.getDataBinder(DataBinderMapperImpl.java:88)
布局文件:
在使用 noDrawable 的库时,前面俩 ImageView 没事,第三个 ImageView 加上上面的 drawable=xxx
和 drawable_selected=xxx
后就会崩溃,并且还找不到具体在哪
drawable_pressed_radius="@{25}"
drawable_pressed_solidColor="@{0xffff0000}"
drawable_radius="@{25}"
drawable_solidColor="@{0xffdadada}"
drawable_enabled_radius="@{25}"
drawable_enabled_solidColor="@{0xff007aff}"
感谢作者开源的项目,但是这个有一个问题就是preview预览情况下,没有办法看到最终效果。
同时设置这两者,drawable_enable设置的orientation和radius不起作用,我将ProxyDrawable直接改成了StateListDrawable就可以了。
drawable_solidColor="@{0xffff0000}" 比如这句 可以支持替换成 drawable_solidColor="@{@color/white}" 吗
当设置渐变色时,elevation阴影第一次不显示
编译时如果出现该错误,请检查是否因为你在gradle.properties中启用了:
android.databinding.enableV2
这是Android Gradle plugin在3.1.+
版本新增的一个实验性的特性,并且不向后兼容;该特性在3.2.
版本开始才默认启用,并且向后兼容。
具体的可以查看关于DataBinding V2的官方文档:New data binding compiler for binding classes
也就是说,如果你的项目的Android Gradle plugin是3.1.+,就请不要开启该特性,即移除上述的配置语句。
由于com.android.tools.build:gradle:3.2.0
还未发布,所以我建议大家暂时不要开启DataBinding V2。
参考issues:
感谢作者开源的项目,但是这个有一个问题就是preview预览情况下,没有办法看到最终效果。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.