Skip to content

Instantly share code, notes, and snippets.

View matsukurou's full-sized avatar

matsukurou matsukurou

View GitHub Profile
@matsukurou
matsukurou / XF_ReadImage.cs
Created June 21, 2015 07:06
Xamarin.Forms で画像を表示する
public class ImagePage : ContentPage
{
public ImagePage()
{
// Imageビューの生成
var image = new Image
{
// 画像を読み込んでSourceプロパティに設定
Source = ImageSource.FromResource("ImageSample.Resources.Images.button_leftArrow.png"),
};
@matsukurou
matsukurou / GitCommand
Last active August 29, 2015 14:23
Gitコマンドまとめ
# Commit内容(メッセージ、著者)を書き換える方法
$ git commit --amend -m "test test test" --author="my_new_name <new_name@example.com>"
メッセージ : test test test
著者 : my_new_name
メールアドレス : new_name@example.com
# 直前のコミットの打ち消し
git reset --soft HEAD^
@matsukurou
matsukurou / XF_Image_LayoutOptionDefault.cs
Last active August 29, 2015 14:23
Xamarin.Forms で配置設定を指定せずに画像を表示する
// 背景色の設定
BackgroundColor = Color.White;
// 全体のレイアウト
var stackLayout = new StackLayout
{
// 縦は真ん中に表示
VerticalOptions = LayoutOptions.Center,
// 横は真ん中に表示
HorizontalOptions = LayoutOptions.Center,
@matsukurou
matsukurou / XF_Image_LayoutOptionFill.cs
Last active August 29, 2015 14:23
Xamarin.Formsで画面幅いっぱいにレイアウトする
// 全体のレイアウト
// レイアウトにスケールをかけているので、レイアウトの中のもの全てにスケールがかかる
var stackLayout = new StackLayout
{
// 縦は真ん中に表示
VerticalOptions = LayoutOptions.Center,
// 横は画面全体に広げる
HorizontalOptions = LayoutOptions.FillAndExpand,
// 背景色を設定
BackgroundColor = Color.White,
@matsukurou
matsukurou / XF_Animation_Move.cs
Last active August 29, 2015 14:24
Xamarin.Formsでビューに移動アニメーションを設定する
{
#region アニメーション用のボックスの生成
// 移動値算出用のボックスを生成
var boxViewBackground = new BoxView
{
Color = Color.Transparent,
};
// 前面アニメーション用のボックスを生成
var boxViewFront = new BoxView
@matsukurou
matsukurou / XF_Animation_Scale.cs
Last active August 29, 2015 14:24
Xamarin.Formsでビューに拡大縮小アニメーションを設定する
{
// 前面アニメーション用のボックスを生成
var boxViewFront = new BoxView
{
Color = Color.Blue,
};
// 拡大縮小アニメ制御用のボタンを生成
var buttonScale = new Button
{
@matsukurou
matsukurou / XF_Animation_RelRotate.cs
Created July 4, 2015 11:30
Xamarin.Formsでビューに回転アニメーションを設定する
{
// 前面アニメーション用のボックスを生成
var boxViewFront = new BoxView
{
Color = Color.Blue,
};
// 回転アニメ制御用のボタンを生成
var buttonRelRotate = new Button
{
@matsukurou
matsukurou / XF_MapPage.cs
Created July 5, 2015 09:28
Xamarin.Formsでマップを表示するためのページ
using System;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
namespace MapSample
{
public class MapPage : ContentPage
{
@matsukurou
matsukurou / XF_MapInitAndroid.cs
Created July 5, 2015 09:31
Xamarin.Formsでマップを初期化する (Android、MainActivity.cs)
[Activity(Label = "MapSample.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
// Xamarin.Forms.Mapsの初期化
@matsukurou
matsukurou / XF_MapInitiOS.cs
Created July 5, 2015 09:32
Xamarin.Formsでマップを初期化する (iOS、AppDelegate.cs)
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
// Xamarin.Froms.Mapsの初期化
Xamarin.FormsMaps.Init();