AppCompatEditText의 내용이 ViewModel의 "ArticleName"속성에 바인딩되어야하는보기가 있습니다. 이것은 디버그 빌드에서 잘 작동하지만 릴리스 빌드에서는 작동하지 않습니다. 이 효과의 이유는 무엇입니까? 대화 상자의 아주 기본적인 ViewModel입니다.릴리스 빌드에서 AppCompatEditText로 데이터 바인딩이 작동하지 않습니다.
<RelativeLayout xmlns:local="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:minWidth="25px"
android:minHeight="25px">
<TextView
android:id="@+id/txtHeadline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_vertical_margin"
android:textAppearance="@android:style/TextAppearance.DialogWindowTitle"
android:text="New item" />
<AppCompatEditText
android:id="@+id/editArticleName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtHeadline"
local:MvxBind="Text ArticleName" />
<Button
android:id="@+id/btnAdd"
android:text="Add"
android:layout_below="@id/editArticleName"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary"
local:MvxBind="Click AddItem;Enabled CanAddItem"
style="?android:attr/borderlessButtonStyle" />
뷰 모델은 :
public class MyViewModel : MvxViewModel
{
private string m_ArticleName;
public string ArticleName
{
get
{
return m_ArticleName;
}
set
{
m_ArticleName = value;
RaiseAllPropertiesChanged();
// this setter is never called
}
}
public MvxCommand AddItem
{
get;
private set;
}
public bool CanAddItem
{
get
{
return !String.IsNullOrEmpty(m_ArticleName);
}
}
public MyViewModel()
{
AddItem = new MvxCommand(doAddItem);
}
private void doAddItem()
{
// is never called in releases build because CanAddItem is never true
}
}
는 또한 영향을 미치지 않고 LinkerPleaseInclude.cs 다음 문을 추가 :
public void Include(AppCompatEditText text)
{
text.TextChanged += (sender, args) => text.Text = "" + text.Text;
text.Hint = "" + text.Hint;
text.Text = "Test";
}
편집 :
동일한에게 효과 AppCompatEditText를 일반 EditText로 교체하면 t가 발생합니다.
경우 뭔가 일을 다음과 같이 변경을 할 수 있습니다 및 릴리스 모드에서 작동하지 않는 것은 난독을 확인 않습니다. – Killer
Proguard가 활성 상태가 아닙니다 (이 설정은 변경되지 않습니다). –