设置布局可见xamarin

时间:2015-11-02 16:59:14

标签: c# android xamarin

我有两项活动。

一个传递归属于另一个。

传递代码

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");

    }

我有阻止,我写这个属性,但它隐藏了。

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

1 个答案:

答案 0 :(得分:1)

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

display.Visibility = ViewStates.Visible;

来自android的原生

display.setVisibility(View.VISIBLE);