[英]Enabled attribute not working in button
我正在使用此鏈接( http://robobinding.github.io/RoboBinding/old_binding_attributes.html )檢查哪些屬性可用。
我試圖在這樣的按鈕中使用“啟用”屬性:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="start"
android:id="@+id/start_button"
bind:enable="{canStart}" />
但是,每當我運行該應用程序時,都會出現以下錯誤:
enabled: Unrecognized attribute 'enabled'
-------------------------The first error stack trace-----------------------
enabled: Unrecognized attribute 'enabled'
at org.robobinding.PendingAttributesForViewImpl.getResolutionErrors(PendingAttributesForViewImpl.java:43)
at org.robobinding.binder.BindingAttributeResolver.resolve(BindingAttributeResolver.java:39)
at org.robobinding.binder.BindingViewInflater.resolveAndAddViewBindingAttributes(BindingViewInflater.java:90)
at org.robobinding.binder.BindingViewInflater.onViewCreated(BindingViewInflater.java:85)
at org.robobinding.ViewFactory.notifyViewCreatedIfNotNull(ViewFactory.java:65)
at org.robobinding.ViewFactory.onCreateView(ViewFactory.java:58)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:177)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
......
如果我更改為“可見性”屬性,則效果很好。
按鈕中是否支持“啟用”屬性?
您應該使用RoboBinding主頁上的新“ API和綁定屬性JavaDocs”鏈接。
所有的simpleOneWayProperties將從RoboBinding框架中刪除,因為可以在需要時聲明它們。 從RoboBinding Gallery項目中可以找到以下示例。
@ViewBinding(simpleOneWayProperties = {"enabled"})
public class ViewBindingForView extends CustomViewBinding< View> {
}
注冊:
reusableBinderFactory = new BinderFactoryBuilder()
.add(new ViewBindingForView().extend(View.class))
.build();
視圖可見性是一個OneWayMultiTypeProperty,因為它支持布爾值和整數。 源代碼在這里-https://github.com/RoboBinding/RoboBinding/blob/develop/framework/src/main/java/org/robobinding/widget/view/ViewBindingForView.java
對於小部件受支持的屬性綁定,除了查看javadoc外,還可以在ViewBinding實現中找到已實現的綁定信息,例如RatingBar- https://github.com/RoboBinding/RoboBinding/blob/develop/framework/src/ main / java / org / robobinding / widget / ratingbar / RatingBarBinding.java
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.