1
我想第一个图像距离屏幕左侧20px,右侧图像距离屏幕右侧20px,尝试了各种各样的东西,但无法使其正常工作。对齐图像 - Android
这里是mycode的:
View v = inflater.inflate(R.layout.fragment_hello_moon, parent, false);
TableLayout tl = (TableLayout)v.findViewById(R.id.l1);
TableRow tr = new TableRow(getActivity());
ImageView imageL = new ImageView(getActivity());
imageL.setImageResource(R.drawable.bell_dl_256);
imageL.setScaleX((float) 0.50);
imageL.setScaleY((float) 0.5);
ImageView imageR = new ImageView(getActivity());
imageR.setImageResource(R.drawable.bell_dr_256);
imageR.setScaleX((float) 0.5);
imageR.setScaleY((float) 0.5);
tr.addView(imageL);
tr.addView(imageR);
tl.addView(tr);
return v;
在桌子上使用piddingLeft和PaddingRight –
也尝试使用“margin”属性。 – David
非常感谢,我将如何分别对齐左侧和右侧的图像,以便它们对齐每个边距? –