[英]C# Xamarin.Android images are displayed in the file manager and not in the gallery
[英]How to add images in a linear layout and empty spaces where there is no images programatically in C#?Xamarin.Android
如果是這樣,則可以使用linearLayout.SetPaddingRelative(imageView1.Drawable.IntrinsicWidth, 0,0,0);
在以下線性布局中設置填充的開始。
有我的代碼。
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);
LinearLayout ll_layout = FindViewById<LinearLayout>(Resource.Id.ll_layout);
LinearLayout linearLayout1 = new LinearLayout(this);
ImageView imageView1 = new ImageView(this);
imageView1.SetImageResource(Resource.Drawable.Capture1);
linearLayout1.AddView(imageView1);
ll_layout.AddView(linearLayout1);
LinearLayout linearLayout2 = new LinearLayout(this);
linearLayout2.SetPaddingRelative(imageView1.Drawable.IntrinsicWidth, 0,0,0);
ImageView imageView2 = new ImageView(this);
imageView2.SetImageResource(Resource.Drawable.Capture2);
linearLayout2.AddView(imageView2);
ll_layout.AddView(linearLayout2);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.