小编Dmi*_*zin的帖子

支持Android材质设计

考虑到即将推出的具有物质风格的Android L平台,我们正在重新设计我们的Android应用程序并提出一个问题:支持旧设备的方式是什么?这个新设计在4.x设备上是否可以接受?

android material android-5.0-lollipop

27
推荐指数
1
解决办法
5788
查看次数

Android数据绑定不适用于<merge>属性

我正在尝试使用自定义视图的数据绑定(George Mount 在此处显示的可能用法).

无法想象在没有<merge>标签的情况下构建复合视图.但是,在这种情况下,数据绑定失败:

MyCompoundView 类:

public class MyCompoundView extends RelativeLayout {

MyCompoundViewBinding binding;

public MyCompoundView (Context context, AttributeSet attrs) {
    super(context, attrs);
    init(context);
}

private void init(Context context){
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    binding = MyCompoundViewBinding.inflate(inflater, this, true);
}
Run Code Online (Sandbox Code Playgroud)

my_compound_view.xml:app:isGone="@{!data.isViewVisible}"我希望控制整个复合视图的可见性

<?xml version="1.0" encoding="utf-8"?>

<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    >

    <data>
        <variable name="data" type="com.example.MyViewModel"/>
    </data>

    <merge
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:isGone="@{!data.isViewVisible}">

        <ImageView
            android:id="@+id/image_image"
            android:layout_width="60dp"
            android:layout_height="60dp"
            app:imageUrl="@{data.imagePhotoUrl}"/>

         <!-- tons of other views-->

    </merge>

</layout>
Run Code Online (Sandbox Code Playgroud)

编译器错误:

Error:(13) No resource identifier …
Run Code Online (Sandbox Code Playgroud)

data-binding android android-databinding

18
推荐指数
1
解决办法
7732
查看次数