1
我需要編輯的ImageView的絕對值:Android Studio中的約束佈局的變化絕對
tools:layout_editor_absoluteY="0dp"
到
tools:layout_editor_absoluteY="50dp"
但在Java中,如果我只是做
ImageView img = (ImageView)findViewById(R.id.mainView);
ConstraintLayout.LayoutParams params1 = (ConstraintLayout.LayoutParams)(img.getLayoutParams());
params1.editorAbsoluteY = 50;
img.setLayoutParams(params1);
它不」工作。
「它不起作用」意味着它不會做改變的價值。 – Vexorei