1

Lets say you have an ImageView or a Button in an Andriod ConstraintLayout.

I know you can set the "Margin" & "Padding" properties in XML individually with:

android:layout_marginTop="15dp"
android:layout_marginBottom="25dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="10dp"

android:paddingStart="1dp"
android:paddingTop="2dp"
android:paddingEnd="3dp"
android:paddingBottom="4dp"

But can you set them all with just one line? E.g.

android:layout_margin="15,25,20,10"
android:padding="1,2,3,4"

And in what order would the properties then come?

  • Top, Bottom, Left(Start), Right(End)?
  • Left(Start), Top, Right(End), Bottom?
0

1 Answer 1

0

No in XML you cannot set them all in one line. But you can do that programmatically like this

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.