달력

52024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'프로그래밍/xamarin'에 해당되는 글 7건

  1. 2018.07.08 [xamarin]팝업창-AbsoluteLayout
  2. 2018.06.24 [xamarin]어플 닫기 전에 물어보고 닫기
  3. 2018.06.10 [xamarin]Lottie Animation
  4. 2018.06.03 [xamarin]CustomRenderers
  5. 2018.05.27 [xamarin]Alert Dialog
  6. 2018.05.20 [xamarin] Profile UI Design
  7. 2018.05.13 [xamarin]로그인화면
반응형


MainPage.xaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?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:App12PopUp"
             x:Class="App12PopUp.MainPage">
 
    <AbsoluteLayout>
        <!-- Main Page Content -->
        <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
                     AbsoluteLayout.LayoutFlags="All">
            
            <Button x:Name="btnPop"
                    Text="팝업창 호출"
                    FontSize="Large"
                    VerticalOptions="CenterAndExpand"
                    HorizontalOptions="CenterAndExpand">
            </Button>
        </StackLayout>
 
        <!-- Overlay -->
        <ContentView x:Name="overlay"
                     AbsoluteLayout.LayoutBounds="0,0,1,1"
                     AbsoluteLayout.LayoutFlags="All"
                     IsVisible="False"
                     BackgroundColor="#C0808080"
                     Padding="10, 0, 10, 0">
            <StackLayout Orientation="Vertical"
                         BackgroundColor="White"
                         HorizontalOptions="Center"
                         VerticalOptions="Center"
                         Padding="10">
                <Label FontSize="18"   
                       TextColor="Black"   
                       HorizontalOptions="Fill"   
                       Text="팝업" />
                
                <StackLayout Orientation="Horizontal" HorizontalOptions="Center">
 
                    <Button x:Name="btnPopCancel"
                            Text="닫기" FontSize="Large"  
                            VerticalOptions="CenterAndExpand"  
                            HorizontalOptions="Center"/>
                </StackLayout>
            </StackLayout>
        </ContentView>
    </AbsoluteLayout>
 
</ContentPage>
 
cs


MainPage.xaml.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
 
namespace App12PopUp
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
 
            this.btnPop.Clicked       += BtnPop_Clicked;
            this.btnPopCancel.Clicked += BtnPopCancel_Clicked;
        }
 
        private void BtnPopCancel_Clicked(object sender, EventArgs e)
        {
            overlay.IsVisible = false;
        }
 
        private void BtnPop_Clicked(object sender, EventArgs e)
        {
            overlay.IsVisible = true;
        }
    }
}
 
cs

실행

   

https://www.c-sharpcorner.com/article/display-popup-using-absolute-layout-in-xamarin-forms/

'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]어플 닫기 전에 물어보고 닫기  (0) 2018.06.24
[xamarin]Lottie Animation  (0) 2018.06.10
[xamarin]CustomRenderers  (0) 2018.06.03
[xamarin]Alert Dialog  (0) 2018.05.27
[xamarin] Profile UI Design  (0) 2018.05.20
Posted by 유령회사
|
반응형

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
 
namespace App11BackButton
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
 
        protected override bool OnBackButtonPressed()
        {
            Device.BeginInvokeOnMainThread(async () =>
            {                
                if (await this.DisplayAlert("알림!""닫을래?""Yes""No"))
                {                    
                    System.Diagnostics.Process.GetCurrentProcess().CloseMainWindow();
                }
            });            
            return true;
        }
    }
}
 
cs


실행

 


참조 : http://ionemind.com/content/exit-ios-and-android-mobile-app-xamarin


다른데는 Dependency써서 하라고 되어있는데 간단하게 되네....자마린은 역시 머가 먼지 모르겠다.


'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]팝업창-AbsoluteLayout  (0) 2018.07.08
[xamarin]Lottie Animation  (0) 2018.06.10
[xamarin]CustomRenderers  (0) 2018.06.03
[xamarin]Alert Dialog  (0) 2018.05.27
[xamarin] Profile UI Design  (0) 2018.05.20
Posted by 유령회사
|
반응형


파일구조

Nuget설치해주시고
Install-Package Com.Airbnb.Xamarin.Forms.Lottie

MainPage.xaml

<?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:App9Animation"
             xmlns:forms="clr-namespace:Lottie.Forms;assembly=Lottie.Forms"
             x:Class="App9Animation.MainPage">
 
    <StackLayout Padding="30">
        <Button x:Name="BtnLogin" 
                Text="Login" 
                BorderColor="#CB9600" 
                BackgroundColor="#F4B400" />
        <forms:AnimationView 
                x:Name="AnimationView"
                Animation="LottieLogo1.json"
                Loop="True"
                AutoPlay="True"
                VerticalOptions="FillAndExpand"
                HorizontalOptions="FillAndExpand"/>
    </StackLayout>
 
</ContentPage>
 
cs

MainPage.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
 
namespace App9Animation
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
 
            this.AnimationView.IsVisible = false;
            this.BtnLogin.Clicked += BtnLogin_Clicked;
        }
 
        private void BtnLogin_Clicked(object sender, EventArgs e)
        {
            this.AnimationView.IsVisible = true;
        }
    }
}
 
cs


MainActivity.cs

using System;
 
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Lottie.Forms.Droid;
 
namespace App9Animation.Droid
{
    [Activity(Label = "App9Animation", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {            
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;
 
            base.OnCreate(bundle);
 
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
 
            AnimationViewRenderer.Init();
        }
    }
}
 
cs


안드로이드에 AnimationViewRenderer.Init();추가

IOS도 추가해야 한다고 하는데 맥이 없는 관계로 ㅠ


사용한 애니메이션 파일

LottieLogo1.json



실행

  


참조

https://github.com/martijn00/LottieXamarin


https://www.lottiefiles.com/



Lottie는 iOS 및 Android 용 Airbnb에서 만든 모바일 애니메이션 라이브러리로 Adobe After Effects 애니메이션 (JSON으로 내 보낸)을 파싱하고 기본 애니메이션 API를 사용하여 렌더링한다고 한다.


'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]팝업창-AbsoluteLayout  (0) 2018.07.08
[xamarin]어플 닫기 전에 물어보고 닫기  (0) 2018.06.24
[xamarin]CustomRenderers  (0) 2018.06.03
[xamarin]Alert Dialog  (0) 2018.05.27
[xamarin] Profile UI Design  (0) 2018.05.20
Posted by 유령회사
|
반응형

파일구조


MainPage.xaml 작성 해주고
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?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:App8CustomRenderers;assembly=App8CustomRenderers"
             x:Class="App8CustomRenderers.MainPage">
 
    <StackLayout VerticalOptions="CenterAndExpand" 
                              HorizontalOptions="CenterAndExpand">
        <Label Text="Hello, Custom Renderer!" />
        <local:MyEntry Text="In Shared Code" />
    </StackLayout>
 
</ContentPage>
 
cs


Forms에 커스텀 할 Entry 적어줌

1
2
3
4
5
6
7
8
9
10
11
12
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
 
namespace App8CustomRenderers
{
    public class MyEntry : Entry
    {
    }
}
 
cs

IOS 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using App8CustomRenderers;
using App8CustomRenderers.iOS;
using Foundation;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
 
[assembly: ExportRenderer(typeof(MyEntry), typeof(MyEntryRenderer))]
namespace App8CustomRenderers.iOS
{
    public class MyEntryRenderer : EntryRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);
 
            if (Control != null)
            {
                // do whatever you want to the UITextField here!
                Control.BackgroundColor = UIColor.FromRGB(204153255);
                Control.BorderStyle = UITextBorderStyle.Line;
            }
        }
    }
}
cs

안드로이드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using App8CustomRenderers;
using App8CustomRenderers.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
 
[assembly: ExportRenderer(typeof(MyEntry), typeof(MyEntryRenderer))]
namespace App8CustomRenderers.Droid
{
    class MyEntryRenderer : EntryRenderer
    {
        public MyEntryRenderer(Context context) : base(context)
        {
        }
 
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);
 
            if (Control != null)
            {
                Control.SetBackgroundColor(global::Android.Graphics.Color.LightGreen);
            }
        }
    }
}
cs


각각 플랫폼에 ExportRenderer를 이용하서 각 플렛폼에 해당하는 프로젝트들이 동작한다.


실행



따라한 소스는 https://developer.xamarin.com/samples/xamarin-forms/CustomRenderers/Entry/


'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]어플 닫기 전에 물어보고 닫기  (0) 2018.06.24
[xamarin]Lottie Animation  (0) 2018.06.10
[xamarin]Alert Dialog  (0) 2018.05.27
[xamarin] Profile UI Design  (0) 2018.05.20
[xamarin]로그인화면  (0) 2018.05.13
Posted by 유령회사
|
반응형

 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?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:App4AlertDialog"
             x:Class="App4AlertDialog.MainPage">
 
    <ContentPage.Content>
        <StackLayout HorizontalOptions="CenterAndExpand"
                     VerticalOptions="CenterAndExpand">
            <Entry Placeholder="School Home-Ground"/>
            <Button x:Name="myBtn"
                    Text="Click To Enter"
                    BackgroundColor="White"
                    Image="clicking.png"/>
        </StackLayout>
    </ContentPage.Content>
 
</ContentPage>
 
cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
 
namespace App4AlertDialog
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
            this.myBtn.Clicked += MyBtn_Clicked;
        }
 
        private void MyBtn_Clicked(object sender, EventArgs e)
        {
            DisplayAlert("타이틀""메세지""Yes""No");
        }
    }
}
 
cs


http://xamaringuyhome.blogspot.kr/2017/10/xamarin-forms-alert-dialog-tutorial-23.html

'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]어플 닫기 전에 물어보고 닫기  (0) 2018.06.24
[xamarin]Lottie Animation  (0) 2018.06.10
[xamarin]CustomRenderers  (0) 2018.06.03
[xamarin] Profile UI Design  (0) 2018.05.20
[xamarin]로그인화면  (0) 2018.05.13
Posted by 유령회사
|
반응형


http://xamaringuyhome.blogspot.kr/2017/10/xamarin-forms-profile-ui-designtutorial.html
이분 소스를 따라 했는데 우리형보단 트와이스라...^^;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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:App2ProfileUIDesign"
             x:Class="App2ProfileUIDesign.MainPage"
             BackgroundColor="Black">
 
    <ContentPage.Content>
        <StackLayout>
            <Image Aspect="AspectFill" Source="https://www.twicenest.com/files/attach/images/223355/134/523/003/7e784764f79b2cba9e881c6c5d7204e8.jpg"/>
            <BoxView HeightRequest="1" BackgroundColor="#ffffff"/>
 
            <StackLayout Padding="15">
                <Label Text="TWICE" 
                       FontAttributes="Bold" 
                       TextColor="White"/>
                <Label Text="TWICE는 JYP 엔터테인먼트에서 miss A 이후 5년 만에 선보인 9인조 다국적 걸그룹으로, 팀명의 의미는 눈으로 한 번, 귀로 한 번해서 두 번 감동을 준다는 뜻이다."
                       TextColor="White" />
            </StackLayout>
 
            <BoxView HeightRequest="1" BackgroundColor="#ffffff"/>
            <StackLayout Orientation="Horizontal" 
                         VerticalOptions="Center" 
                         HorizontalOptions="Center"/>
            <Button Text="NextPage"/>
        </StackLayout>
    </ContentPage.Content>
 
</ContentPage>
 
cs


'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]어플 닫기 전에 물어보고 닫기  (0) 2018.06.24
[xamarin]Lottie Animation  (0) 2018.06.10
[xamarin]CustomRenderers  (0) 2018.06.03
[xamarin]Alert Dialog  (0) 2018.05.27
[xamarin]로그인화면  (0) 2018.05.13
Posted by 유령회사
|
반응형

http://xamaringuyhome.blogspot.kr/2017/10/


이분의 소스를 따라 쳐봤음





MainPage.xaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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:App1Login"
             x:Class="App1Login.MainPage">
 
    <Grid>
        <ScrollView>
            <StackLayout>
                <StackLayout Padding="30" Spacing="2" VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand">
                    <Label Text="Name or Phone Number" 
                           TextColor="#555" 
                           FontSize="20" 
                           FontAttributes="Bold"/>
                    <Entry Keyboard="Numeric" 
                           Placeholder="Enter Authinticated Phone Number Or Name" 
                           PlaceholderColor="#CCC" 
                           FontSize="20" 
                           TextColor="#555" />
                    <Label Text="Password" 
                           TextColor="#555" 
                           FontSize="20" 
                           FontAttributes="Bold"/>
                    <Entry  Placeholder="Enter correct password" 
                            Keyboard="Default" 
                            IsPassword="True" 
                            FontSize="20" 
                            PlaceholderColor="#CCC" 
                            TextColor="#555" />
                </StackLayout>
                <StackLayout Padding="30" VerticalOptions="CenterAndExpand" HorizontalOptions="FillAndExpand">
                    <Button x:Name="BtnLogin" Text="Login" BorderColor="#CB9600" BackgroundColor="#F4B400"/>
                </StackLayout>
            </StackLayout>
        </ScrollView>
 
       
        <ActivityIndicator x:Name="activityIndicator" 
                           IsRunning="{Binding IsBusy}" 
                           VerticalOptions="Center" 
                           HorizontalOptions="Center" 
                           Color="Blue" />
    </Grid>
 
</ContentPage>
 
cs


MainPage.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
 
namespace App1Login
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
 
            // Define the binding context
            this.BindingContext = this;
 
            // Set the IsBusy property
            this.IsBusy = false;
 
            // Login button action
            this.BtnLogin.Clicked += BtnLogin_Clicked;
        }
 
        private void BtnLogin_Clicked(object sender, EventArgs e)
        {
            this.IsBusy = true;
        }
    }
}
 
cs


'프로그래밍 > xamarin' 카테고리의 다른 글

[xamarin]어플 닫기 전에 물어보고 닫기  (0) 2018.06.24
[xamarin]Lottie Animation  (0) 2018.06.10
[xamarin]CustomRenderers  (0) 2018.06.03
[xamarin]Alert Dialog  (0) 2018.05.27
[xamarin] Profile UI Design  (0) 2018.05.20
Posted by 유령회사
|