我正在dimen文件中定义边距或填充
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="dp_12">12dp</dimen>
</resources>
并在布局中使用它
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_12"
android:orientation="horizontal"/>
但是似乎它不可重复使用,因为将来如果我想将其更改为16dp,则必须在dimen文件中定义dp_16,并在布局文件中的每个位置都更改dp_12。有更好的方法吗?