我有一个主线性布局,其中包含动态生成的线性布局。我在ACTION_DOWN上对这些布局进行动画处理,但是如果我尝试更改一个布局的边距(顶部或底部),它也会影响其他布局。如何在不影响其他布局的情况下更改一个布局的边距。
非常感谢任何帮助。
谢谢。
编辑
public View getLinearView() {
ChildLinearLayout linearLayout = new ChildLinearLayout(context);
LayoutParams layoutParams = new LayoutParams(500, 500);
linearLayout.setLayoutParams(layoutParams);
linearLayout.setBackgroundColor(Color.RED);
layoutParams.setMargins(20, 20, 20, 20);
layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
TextView textView = new TextView(context);
textView.setText("Hello World");
linearLayout.addView(textView);
System.out.println("View Added");
views.add(linearLayout);
return linearLayout;
}