我正在使用自定义可绘制对象来渲染Android TextView周围的边框。
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:bottom="1dp" android:left="-2dp" android:right="-2dp" android:top="-10dp">
<shape android:shape="rectangle" >
<stroke android:width="1dp" android:color="@color/pale_grey" />
<solid android:color="#00FFFFFF" />
<padding android:left="24dp" android:right="24dp"
android:top="12dp" android:bottom="12dp" />
</shape>
</item>
</layer-list>
这在运行时效果很好,但是在查看具有TextView且应用了该背景的Activity时,例如在Xamarin Studio Designer(或Visual Studio中的设计器)中无法呈现它,例如
<TextView
android:id="@+id/txtHeightSelection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:textSize="@dimen/text_size_large"
android:text="Height"
android:textStyle="bold"
android:textColor="#1f2233"
android:background="@drawable/customborder2"
local:MvxBind="Click AddEntryCommand, CommandParameter='Height'" />
毫无疑问,这是一个PITA,因为我必须构建和部署该应用程序才能检查一些简单的样式。这是一个已知的问题?
这是一个已知问题,即将发布的版本(标记为5.7)正在解决:
解决方法是,在十六进制编辑器(包括在Xamarin Studio中)中打开可绘制文件,并删除前三个字节(如果此顺序为)EF BB BF
。
从Bugzilla:
The issue comes from the fact that our Android rendering process doesn't like the UTF-8 BOM sequence we forcefully add to XML files in some places.
A simple workaround is to open the drawable XML files in an editor that doesn't write a BOM and re-save the file from there. You can also open it up in an hexadecimal editor and remove the first three bytes of the file (before the initial '<').
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句