设置布局可见xamarin

本文关键字:xamarin 布局 设置 | 更新日期: 2023-09-27 18:20:25

我有两个活动。

一个过程属于另一个过程。

通过的代码

add.Click += delegate {
            var intent = new Intent (this, typeof(CartActivity));
            intent.PutExtra ("title", (string)(firstitem ["post_title"]));
            intent.PutExtra ("price", (string)(firstitem ["price"] + " грн"));
            intent.PutExtra ("weight", (string)(firstitem ["weight"] + "г"));
            StartActivity (intent);
        };

接收代码

private void Display (){
        LinearLayout display = FindViewById<LinearLayout> (Resource.Id.linearLayout13);         
        TextView productname = FindViewById<TextView> (Resource.Id.posttittle);
        TextView price = FindViewById<TextView> (Resource.Id.price);
        TextView weight = FindViewById<TextView> (Resource.Id.weight);
        productname.Text = Intent.GetStringExtra("title");
        price.Text = Intent.GetStringExtra("price");
        weight.Text = Intent.GetStringExtra("weight");
    }

我有块,在那里我写这些属性,但它是隐藏的。

当属性写入此块时,我如何使其可见?

设置布局可见xamarin

我假设显示是您的块,所以在Xamarin 中应该是这样

display.Visibility = ViewStates.Visible;

来自android的原生

display.setVisibility(View.VISIBLE);