余白をゼロに設定すると、画像が画面全体に表示されます。しかし、マージンを100に設定するには、右側を除いてすべて正しく適合します。なぜそれをするのですか?
ImageView imagen = new ImageView(this);
RelativeLayout relative = new RelativeLayout(this);
RelativeLayout.LayoutParams labelLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
relative.setLayoutParams(labelLayoutParams);
RelativeLayout rl = new RelativeLayout(this);
RelativeLayout.LayoutParams layoutImagenClicker = new RelativeLayout.LayoutParams
(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
layoutImagenClicker.setMargins(0, 0, 0, 0);
imagen.setBackgroundResource(R.drawable.barra_seek_bar);
imagen.setLayoutParams(layoutImagenClicker);
rl.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
rl.addView(imagen);
relative.addView(rl);
setContentView(relative);
ImageView imagen = new ImageView(this);
RelativeLayout relative = new RelativeLayout(this);
RelativeLayout.LayoutParams labelLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
relative.setLayoutParams(labelLayoutParams);
RelativeLayout rl = new RelativeLayout(this);
RelativeLayout.LayoutParams layoutImagenClicker = new RelativeLayout.LayoutParams
(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
layoutImagenClicker.setMargins(100, 100, 100, 100);
imagen.setBackgroundResource(R.drawable.barra_seek_bar);
imagen.setLayoutParams(layoutImagenClicker);
rl.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
rl.addView(imagen);
relative.addView(rl);
setContentView(relative);
同じパディングで異なるマージン?
layoutImagenClicker.setMargins(0, 0, 0, 0);
layoutImagenClicker.setMargins(100, 100, 100, 100);
これを見て!
layoutImagenClicker.setMargins(100, 100, 200, 100);
同じ結果がマージンを100または200に設定します。これはバグですか?