java Android布局边距使宽度为0
当我试图在Java中更改某些内容的左边距或右边距时,它不起作用。相反,它会将按钮缩小到宽度为0dp的位置。 这是我的密码:
RelativeLayout.LayoutParams TwoPos = (RelativeLayout.LayoutParams) ezONEaONE.getLayoutParams();
TwoPos.bottomMargin = 515;
TwoPos.leftMargin = 50;
ezONEaONE.setLayoutParams(TwoPos);
布局中的“我的”按钮:
<Button
安卓:text="@string/ez1a1"
安卓:id="@+id/ez1a1"
安卓:background="@安卓:color/holo_orange_dark"
安卓:textSize="24sp"
tools:ignore="Deprecated,NewApi,RtlHardcoded,TextViewEdits"
安卓:onClick="Ez1A1"
安卓:minWidth="88dp"
安卓:minHeight="46dp"
安卓:autoText="false"
安卓:layout_height="wrap_content"
安卓:layout_width="wrap_content"
安卓:layout_marginBottom="10dp"
安卓:typeface="serif"
安卓:layout_above="@+id/ez1N1" />
# 1 楼答案
您可能必须将
dp
放在末尾。对不起,如果它不起作用# 2 楼答案
删除此项: