本文介绍了我怎样才能获得PixlUI为Android自定义字体工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用来实现自定义字体到我Android应用使用Xamarin。我已经遵循下列步骤进行:

I am trying to use PixlUI to implement custom fonts into my Android app using Xamarin. I've followed these steps:


  1. 增加了一个新的Andr​​oid的Java库绑定到我的主要解决方案

  2. 新增来的罐子文件夹

  3. 在为pixlui-1-0-5.jar性能我已经设置为true
  4. 在部署中包括
  5. 测试我新的Andr​​oid的Java绑定库并没有错误建立精细

  6. 在主项目我已经添加了我的字体的资产/ fonts文件夹

  7. 在引用我已经添加了pixlUI绑定库

  8. 在我main.axml我已经放在这个code:

  1. Added a new Android Java Bindings Library to my main solution
  2. Added pixlui-1-0-5.jar to the jars folder
  3. Under properties for pixlui-1-0-5.jar i've set the "include in deploy" to true
  4. Tested my new Android Java Bindings Library and it builds fine without errors
  5. Under the main project i've added my font to the assets/fonts folder
  6. Under references i've added the pixlUI binding library
  7. In my main.axml i've placed this code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pixlui="http://schemas.android.com/apk/com.neopixl.pixlui"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:screenOrientation="portrait">

<com.neopixl.pixlui.components.textview.TextView
android:id="@+id/textViewpixl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
pixlui:copyandpaste="false"
pixlui:clearclipboardcontent="true"
pixlui:typeface="Lato-Light.ttf" 
android:layout_below="@id/btnRebate"
 />
</RelativeLayout>


当我建立我的项目失败与错误10所有引用已经包含了定义...与pixlUI文件内部错误cs0102。

When I build my project it fails with 10 errors all referencing "already contains a definition for..." with error cs0102 inside the pixlUI files.

例如: .../pixlUI/obj/Debug/generated/src/Com.Neopixl.Pixlui.Components.Edittext.IEditTextBatchListener.cs(59,59):错误CS0102:类型 Com.Neopixl.Pixlui.Components.Edittext.AddNewCharEventArgs'已经包含了一个定义 P0'(CS0102)(pixlUI)

Ex: .../pixlUI/obj/Debug/generated/src/Com.Neopixl.Pixlui.Components.Edittext.IEditTextBatchListener.cs(59,59): Error CS0102: The type Com.Neopixl.Pixlui.Components.Edittext.AddNewCharEventArgs' already contains a definition forp0' (CS0102) (pixlUI)

我试图解决此,但它似乎是要么pixlUI的问题,或在我的解决方案已经事冲突。有没有人对如何解决这个想法?

I've tried troubleshooting this but it appears to be either an issue with pixlUI or conflict with something already in my solution. Does anyone have an idea on how to solve this?

推荐答案

首先,你应该更改pixelui.jar到的 EmbeddedJar 的生成操作。

First of all, you should change the Build Action for the pixelui.jar to EmbeddedJar.

然后,你需要将以下添加到您绑定的的 metadata.xml中的文件:

Then you need to add the following to your binding's Metadata.xml file:

<!-- Bindings added to rename event parameters  -->
<attr path="/api/package[@name='com.neopixl.pixlui.components.edittext']/interface[@name='EditTextBatchListener']/method[@name='addNewChar']/parameter[@name='p0']" name="name">editText</attr>
<attr path="/api/package[@name='com.neopixl.pixlui.components.edittext']/interface[@name='EditTextBatchListener']/method[@name='deleteKeyboardButton']/parameter[@name='p0']" name="name">editText</attr>
<attr path="/api/package[@name='com.neopixl.pixlui.components.edittext']/interface[@name='EditTextBatchListener']/method[@name='deleteKeyboardButton']/parameter[@name='p1']" name="name">emptyText</attr>

<attr path="/api/package[@name='com.neopixl.pixlui.components.edittext']/interface[@name='EditTextFocusListener']/method[@name='loseFocus']/parameter[@name='p0']" name="name">editText</attr>
<attr path="/api/package[@name='com.neopixl.pixlui.components.edittext']/interface[@name='EditTextFocusListener']/method[@name='requestFocus']/parameter[@name='p0']" name="name">editText</attr>

重建你的绑定,那么你应该能够在Android应用中使用它。

Rebuild your bindings then you should be able to use it in your Android app.

下面是从样本项目中的截图:

Here's a screenshot from the sample project:

这篇关于我怎样才能获得PixlUI为Android自定义字体工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 02:25