Android:布局文件边距/填充快捷方式

Pur*_*key 8 android android-layout

嗨,你知道是否有一种快捷方式来设置你的布局文件,有点像CSS.例如而不是

android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
Run Code Online (Sandbox Code Playgroud)

也许是这样的?

android:layout_margin="20dp, 20dp, 10dp, 5dp"
Run Code Online (Sandbox Code Playgroud)

Padding/Radius等也一样......

Dee*_*pak 8

如果你想为所有方设置相同的值,那么你可以像这样使用:

android:layout_margin="20dp"
Run Code Online (Sandbox Code Playgroud)

如果你对所有方面都有不同的价值,那么你必须以这种方式设置它们:

android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
Run Code Online (Sandbox Code Playgroud)

和填充相同的东西.