我尝试动态地设置在我的应用程序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