【问题标题】:How to apply kenburnseffect into crossplatform xamarin imageview?如何将 kenburnseffect 应用到跨平台 xamarin imageview 中?
【发布时间】:2019-11-09 10:42:47
【问题描述】:

我正在使用 xamarin 移动应用程序。我必须在标题图像中设计和应用 ken burns 效果。我一直在寻找,但没有得到任何解决方案?请帮助我,任何人。谢谢。

【问题讨论】:

  • 通过搜索,我只是找到了在 Android 中使用 kenburnview 的方法,没有找到在 Xamarin.forms 中使用它的方法
  • 是的..这是否可以在 xamarin 中应用?

标签: xamarin.forms cross-platform


【解决方案1】:

如果你想在xamarin.android中应用kenburneffect,你可以看看以下步骤:

首先,你需要安装Xamarin.kenBurnsView,然后在android中使用。

<?xml version="1.0" encoding="utf-8"?>

android:layout_width="match_parent"
android:layout_height="match_parent">
<com.flaviofaria.kenburnsview.KenBurnsView 
    android:id="@+id/kenBurnsView1" 
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:src="@drawable/a11" />
<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:layout_alignParentBottom="true" 
    android:weightSum="2">

    <Button android:id="@+id/button1" android:text="resume" 
            android:layout_width="0dp" 
            android:layout_height="wrap_content" 
            android:layout_weight="1" />
    <Button android:id="@+id/button2" android:text="pause" 
            android:layout_width="0dp" 
            android:layout_height="wrap_content" 
            android:layout_weight="1" />

</LinearLayout>

  protected override void OnCreate(Bundle savedInstanceState)
    {        

        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.layout12);


        var kenburnimage = FindViewById<KenBurnsView>(Resource.Id.kenBurnsView1);
        FindViewById<Button>(Resource.Id.button1).Click += delegate { kenburnimage.Resume(); };

        FindViewById<Button>(Resource.Id.button2).Click += delegate { kenburnimage.Pause(); };


    }

【讨论】:

  • 我需要在 xamarin 表单中集成 kenburneffect android 和 ios。
猜你喜欢
  • 2019-11-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-20
  • 1970-01-01
  • 2018-10-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多