【问题标题】:How to add Click Event in CircleImageView Xamarin如何在 CircleImageView Xamarin 中添加点击事件
【发布时间】:2016-10-03 01:59:35
【问题描述】:

大家好,我如何在 refractored.controls.CircleImageView 中添加点击事件 我在 axml 中设置了

           android:clickable="true"

我的代码

       NavigationView navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);
        if (navigationView != null)
        {
            SetUpDrawerContent(navigationView);
            var navEvnt = navigationView.FindViewById<CircleImageView>(Resource.Id.masterUser);
            navEvnt.Click += (sender, e) => 
            {
                Intent inf = new Intent(navigationView.Context, typeof(MessageLayout));
                StartActivity(inf); 
            };
        }

但我总是收到 System.NullReferenceException 错误:对象引用未设置为对象的实例。听起来找不到我的 CircleImageView id

【问题讨论】:

  • 你能展示更多你的 XML 吗?我需要查看 -Tag。

标签: xamarin xamarin.android


【解决方案1】:

我忘记了我的 CircleImageView 在我的 nav_header 布局中,所以完成它我必须首先使用上面的图像获取 headerlayout。

【讨论】:

    猜你喜欢
    • 2020-04-05
    • 1970-01-01
    • 1970-01-01
    • 2019-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-08
    • 1970-01-01
    相关资源
    最近更新 更多