Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

dynamically create ImageView

$
0
0

I am trying to make ImageView dynamically and add it into a LinearLayout. But I can hardly get it working.. Here is my code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/layoutBase">
</LinearLayout>
LinearLayout linearLayout = activity.FindViewById<LinearLayout> (Resource.Id.layoutBase);
ImageView image = new ImageView (); // what should I put in as an input?
linearLayout.AddView(image);

image.Width = "fill_parent";  // read only error
image.Height = "fill_parent"; // read only error
image.SetX (10);
image.SetY (10);
image.Visibility = false; // read only error

What should I put in to ImageView constructor as an input? And how can I set its width and height as "fill_parent" and zero visivility?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>