[Xamarin.Android] 使用Component套件

[Xamarin.Android] 使用Component套件

前言

在Xamarin中,可以将自己开发的项目包装成为Component套件发布至Xamarin Component Store,来提供其他开发人员使用。本篇介绍如何下载并安装Component套件,让开发人员能够使用Xamarin Component Store中的各种Component套件,为自己留个纪录也希望能帮助到有需要的开发人员。

前言01

使用

  1. 在Xamarin.Android项目中的Components文件夹上,点击右键并且选择「Get More Components...」。

    使用01

  2. 选择项目使用的Component套件,来开启Component套件的套件说明。

    使用02

  3. 点选「Add to App」来将Component套件加入目标项目。

    使用03

  4. 在Components文件夹中新安装的Component套件上,点击右键并且选择「Edit Component...」,就可以开启Component套件的套件说明。

    使用04

    使用05

  5. 接着依照套件说明介绍的使用方法,在Xamarin.Android项目加入对应的程序代码。

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:flatui="http://schemas.android.com/apk/res-auto"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="20dp">
    
      <FlatUI.FlatEditText
          android:id="@+id/edittextFlat2"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          flatui:fieldStyle="box"
          flatui:cornerRadius="3dip"
          android:layout_margin="10dp"
          android:text="Clark"/>
    
      <FlatUI.FlatButton
          android:id="@+id/buttonBlock"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="10dp"
          android:text="Click Me"
          flatui:textAppearance="none" />
    
      <FlatUI.FlatToggleButton
          android:id="@+id/toggleUncheckedEnabled"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="10dp"
          flatui:size="20dip" />
    
    </LinearLayout>
    
  6. 执行Xamarin.Android项目,就可以看到Component套件在项目中运作的结果。

    使用06

原文地址:https://www.cnblogs.com/clark159/p/4035108.html