小编Мак*_*люк的帖子

多维构建风格中的不同签名配置

小例子将描述这种情况:

flavorDimensions 'shape', 'api'

productFlavors {
        fruit {
             dimension "shape"
        }

        vegtable {
             dimension "shape"
        }

        production {
             dimension "api"
        }

        development {
             dimension "api"
        }
}
Run Code Online (Sandbox Code Playgroud)

任务: 我需要为fruitProductionfruitDevelopment风格保留不同的签名配置。

我研究了 gradle 文档,但没有找到合适的任务,可以覆盖特殊风格的配置。

android android-productflavors android-build-flavors android-flavors apk-signing

5
推荐指数
0
解决办法
227
查看次数

Android双向数据绑定用于带参数的方法

模型的setter和getter方法具有一个参数,如下所示:

public int getPrice(Object key) {
}

public void setPrice(Object key, int price) {
}
Run Code Online (Sandbox Code Playgroud)

XML看起来像这样:

<EditText
android:id="@+id/edtPrice"
style="@style/CreateShipperItemValueEditTextView"
android:layout_centerVertical="true"
android:hint="@string/hint_price"
android:inputType="number"
android:maxLines="1"
android:text="@={shipper.getPrice(priceKey)}"/>
Run Code Online (Sandbox Code Playgroud)

android:text =“ @ = {shipper.getPrice(priceKey)}”

构建过程中的编译器错误表明我们应该使用@InverseMethod批注。我尝试这样的事情:

@InverseMethod(value = "getPrice")
@Override
public void setPrice(Object key, int price) {
    super.setPrice(key, price);
}
Run Code Online (Sandbox Code Playgroud)

但是在这种情况下,我有下一个错误。

error: @InverseMethods must have a non-void return type
Run Code Online (Sandbox Code Playgroud)

因此,我很高兴在这里对整个流程进行很好的解释。谢谢

android inverse two-way android-databinding two-way-binding

2
推荐指数
1
解决办法
3215
查看次数