0
データバインディングでsetTextColorを試したときにTextViewが表示されなくなりました。誰もがこの問題を修正する方法または回避する方法を知っていますか?どうもありがとう。データバインディングでsetTextColorを試したときにTextViewが消える
app:txtColor="@{tickerModel.diffPriceColor}"
希望はあなたの問題を解決することができます:代わりに ":の、textColorアンドロイド" の行の次のレイアウトの使用に
@BindAdapter({"txtColor"})
public static void setTxtColor(View view, String color){
((TextView)view).setTextColor(Color.parseColor(color));
}
BindAdapter
使用 <TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="right"
android:textColor="@{tickerModel.diffPriceColor}"
android:text="@{tickerModel.mName}"/>
私は以下のようにBindingAdapterを使用しようとしましたが、前と同じ問題です。 –
アルファベットはありますか?例えば。 0x000000FF –