私はAndroidのデータバインディングライブラリを使用しています。私はデータオブジェクトをBaseObservable
まで延長しています。Android:データバインディング、notifyPropertyChanged()が機能していませんか?
public static class SimpleData extends BaseObservable implements Serializable {
private String text, subText;
private SpannableString totalText;
@Bindable
public SpannableString getTotalText() {
return totalText;
}
public void setTotalText(SpannableString totalText) {
this.totalText = totalText;
notifyPropertyChanged(BR.totalText);
}
}
そして、私のXMLは
<TextView
android:id="@+id/patient_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="16dp"
android:layout_toRightOf="@+id/patient_image"
android:textColor="@color/primary_text"
android:text="@{object.getTotalText()}"
/>
結合は、初期値のために行われるにもバインドされます。しかし、値を変更すると、値を変更すると、変更がテキストビューに反映されません。
object.setTotalText(someSpannableString);
何が問題なの?
問題を解決できますか? –
@mahdipishguy:いいえ。問題はまだ解消されていません。 – Ashwin