我嘗試動態地設置在我的應用程序View.GONE將無法正常工作
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
</data>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="@dimen/list_item_height"
android:orientation="horizontal"
android:padding="@dimen/bordersize_big">
<ImageView
android:id="@+id/listitem_icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0"
android:minWidth="@dimen/fingersize"
android:src="@drawable/selector_icon_filecard"
android:visibility="@{View.GONE}"
tools:ignore="ContentDescription">
可見性,但圖像仍清晰可見,如果我設置android:visibility="gone"
就消失了,這有什麼錯我的數據綁定?
LayoutInflater vi = (LayoutInflater) this.activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = vi.inflate(listItemResource, null);
請張貼你如何膨脹這種佈局。 – subhash
我已添加代碼 – wutzebaer
您應該將其更改爲,查看v = DataBindingUtil.inflate(vi,listItemResource,null).getRoot();像這樣: – subhash