gpt4 book ai didi

android - 仅限 Android 4.0 上的 MvxSpinner 空白

转载 作者:行者123 更新时间:2023-11-29 15:18:38 24 4
gpt4 key购买 nike

我有一个自定义绑定(bind)的 MvxSpinner,它与我的 Android 和 iOS 应用程序之间共享的 ViewModel 配合得很好。在 Android API 级别 15 (4.0.3) 及更高版本上,一切看起来都很棒,但在 Android API 级别 14 (4.0) 上,微调器为每个 ListItem 元素显示空白文本。 ListItems 在那里,但 Text 只是空白。当我在 Android 4.0 上进行选择时,正确的值会传回所选项目的 ViewModel,我的应用程序也会相应更新。

Android 4.0 上的 MxvSpinner 是否存在任何已知错误?

这是我的 MvxSpinner 的 XML:

<MvxSpinner
style="@style/spinner_input"
local:MvxItemTemplate="@layout/item_spinner"
local:MvxDropDownItemTemplate="@layout/item_spinnerdropdown"
local:MvxBind="ItemsSource ProductCategoryOptions; SelectedItem SelectedProductCategory" />

这是我的模板:

item_spinner

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/black"
android:text="Test"
local:MvxBind="Text Caption" />

Item_SpinnerDropDown

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
local:MvxBind="Text Caption" />

最佳答案

因为这个问题还没有被标记为已回答,我不知道答案是否已经找到,所以我把我的解决方案贴出来供以后的读者引用。

将以下代码放入名为 LinkerPleaseInclude.cs 的文件中:

public void Include(CheckedTextView checkedText)
{
checkedText.TextChanged += (sender, args) => checkedText.Text = string.Empty + checkedText.Text;
checkedText.Hint = string.Empty + checkedText.Hint;
}

这是链接器包含 CheckTextView 绑定(bind)所必需的。这适用于 Android API 16 v4.1.x,并在 VS2013 中启用了链接“仅限 Sdk 程序集”。

关于android - 仅限 Android 4.0 上的 MvxSpinner 空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21196559/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com