アンドロイドとIOSのxamarinでsdkまたはライブラリを作成できますか?また、ライブラリやSDKにもUI(ビュー)が含まれている必要があります。ライブラリやSDKに、xamarinの他のプロジェクトで使用できるビューを含めることは可能でしょうか?xamarinでandroidとiosのビューでsdk/libraryを作成することはできますか?
0
A
答えて
0
はい! Xamarin.FormsのBindable Propertiesを使用してカスタムコントロールを作成し、それをNugetパッケージにパッケージ化することができます。例えば
:あなたは別のフォルダにContentView
を作成することができますが
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BindablePropertyDemo.Custom.MyCustomControl">
<Grid x:Name="grid"
Padding="10,40,10,10"
HeightRequest="160"
VerticalOptions="Start">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image x:Name="image"
HeightRequest="100"
HorizontalOptions="Center"/>
<Label x:Name="title"
Text="BASKETBALL"
Grid.Row="1"
FontSize="20"
VerticalOptions="Center"
TextColor="White"
HorizontalOptions="Center"
FontAttributes="Bold"/>
</Grid>
</ContentView>
MyCustomControlと呼ばれ、その後、あなたは、このような任意のページから、このコントロールを呼び出すことができます。
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BindablePropertyDemo"
xmlns:custom="clr-namespace:BindablePropertyDemo.Custom"
x:Class="BindablePropertyDemo.MainPage"
BackgroundColor="#33334c">
<ScrollView>
<Grid RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid BackgroundColor="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid BackgroundColor="#ff4284" Padding="10">
<Image Source="hamburger.png"/>
</Grid>
<Label Grid.Column="1"
Text="Home"
TextColor="#ff4284"
FontSize="20"
Margin="5,0,0,0"
HorizontalOptions="Start"
VerticalOptions="Center"/>
</Grid>
<StackLayout Spacing="0" Grid.Row="1"><
<!-- SEE HERE!! -->
<custom:MyCustomControl BackgroundColor="#76dab2"
TitleText="BASKETBALL"
Image="basketball.png"/>
<custom:MyCustomControl BackgroundColor="#7c57e4"
TitleText="FOOTBALL"
Image="football.png"/>
<custom:MyCustomControl BackgroundColor="#f1b136"
TitleText="GRIDIRON"
Image="gridiron.png"/>
</StackLayout>
</Grid>
</ScrollView>
</ContentPage>
そして、あなた次のような結果になります。
私はこのtutorialの例を取り上げましたが、引き続き詳細を知ることができます。
あなたがここに自分のソースコードを見つけることができます。https://github.com/mindofai/BindablePropertyDemo
関連する問題
- 1. Xamarin Visual StudioでAndroid Studioで作成したAVDを使用することはできますか?
- 2. ビューでcsvからdjangoモデルを作成することはできますか?
- 3. XamarinはネイティブiOSとAndroid AppsのクライアントSDKを作成するために使用できますか?
- 4. このiOSビューとは何ですか?
- 5. WindowsコードでiOSアプリケーションを作成することはできますか?
- 6. iOSで通話追跡アプリを作成することはできますか?
- 7. ビューのスタティック部分を作成することはできますか
- 8. AndroidビューのSimpleCursorAdapterで、ギャラリービューでビットマップをリサイクルすることはできますか?
- 9. Xamarin Androidでテーブルレイアウトを動的に作成できますか?
- 10. IOSのビューにタッチするとタッチポイントで輝くことができますか?
- 11. 後でプラグインと拡張機能をダウンロードできるIOSアプリを作成することはできますか?
- 12. TFS2017でAndroidアプリとiOSアプリを構築することはできますか?
- 13. Xamarin iOS Designerでビューの周りに枠線を作成しますか?
- 14. AndroidでPDFビューアを作成することはできますか?
- 15. iOSでこのタイプのビューを作成するには
- 16. jQueryでスクリプトタグを作成することはできますか?
- 17. Chromeでダイナミックテーマを作成することはできますか?
- 18. @IBOutletをカスタムビューで作成することはできますか?
- 19. Goでコンテキストマネージャを作成することはできますか?
- 20. iTextsharpでイメージライブラリを作成することはできますか?
- 21. Xcodeでデータブレークポイントを作成することはできますか?
- 22. ユーザーコントロールでイベントを作成することはできますか?
- 23. Doxygenでカスタムオブジェクトタイプを作成することはできますか?
- 24. FluentMigratorでトリガーを作成することはできますか?
- 25. iphoneでバックグラウンドサービスを作成することはできますか?
- 26. プログラムでハッシュルールを作成することはできますか?
- 27. アンドロイドでスタンドアロンブロードキャストレシーバを作成することはできますか?
- 28. Javascriptでオーディオレコーダーを作成することはできますか?
- 29. 通知はxamarinでIOSとANDROIDアプリを起動します
- 30. iOSでフレームごとにプログラムでビデオを作成することはできますか?
をあなたはこのサードパーティのコンポーネントを参照することがあります。https://www.nuget.org/packages/Adapt.Presentation/、そのコードはgithubの上のオープンソースであります。 –