1
我有一个只能在调试模式下工作的转换器。当我生成一个Release .apk时,它不再起作用。ColorStateList Converter只能在调试模式下工作
这里是我的代码:
public class CardapioImageColorConverter : MvxValueConverter<bool, ColorStateList>
{
private static Activity Activity => Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity;
protected override ColorStateList Convert(bool value, Type targetType, object parameter, CultureInfo culture)
{
ColorStateList color;
if (value)
color = Activity.Resources.GetColorStateList(Resource.Color.cor1,Activity.Theme);
else
color = Activity.Resources.GetColorStateList(Resource.Color.white, Activity.Theme);
return color;
}
}
而且我axml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="70dp"
android:layout_height="70dp">
<Mvx.MvxImageView
android:id="@+id/imageView"
android:layout_weight="1"
android:tint="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
local:MvxBind="ImageUrl Icone;ImageTintList CardapioImageColor(Selecionado);"
android:layout_gravity="center" />
<TextView
local:MvxBind="Text Nome; TextColor CardapioTextColor(Selecionado);"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/cor1"
android:textSize="11dp"
android:layout_weight="1.9"
android:text="@string/lista_espera"
android:gravity="center"
android:layout_marginBottom="@dimen/margin_tiny"
android:layout_marginTop="@dimen/margin_tiny" />
</LinearLayout>
它完全在调试模式。你有什么想法为什么会发生?
你对Mvx.MvxImageView使用任何第三方库吗? –
在调试模式下,尝试启用链接器,那么你会得到任何错误? – Cheesebaron
我只用sdk Assemblies,这两种情况。 DeBug和Release。 –