Issue
I am using a custom drawable to render a border around an 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>
This works fine at runtime but is not rendered in Xamarin Studio Designer (or the designer in Visual Studio) when viewing an Activity that has a TextView with that background applied e.g.
<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'" />
Unsuprisingly this is a PITA as I have to Build and deploy the app just to check some simple styling. Is this a known issue?
Solution
This is a known issue that is being addressed in a coming release (flagged as 5.7):
As a workaround, open the drawable file in a hex editor (included in Xamarin Studio) and remove the first three bytes if they are this sequence: EF BB BF
.
From 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 '<').
Answered By - matthewrdev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.