cytus源码
2024-11-19 02:36
1.Androidå¦ä½å¨java代ç ä¸è®¾ç½®margin
2.安卓编程 如何在Java代码里设置button的margin(外边距)?
Androidå¦ä½å¨java代ç ä¸è®¾ç½®margin
é¦å å®ä¹ä¸ªLayoutParamsï¼ç¶åå¨è®¾ç½®marginï¼å¨æè¿ä¸ªLayoutParams设置ç»æ§ä»¶ï¼å¦ä¸ï¼
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(,,,);//4个åæ°æ顺åºåå«æ¯å·¦ä¸å³ä¸
mView.setLayoutParams(layoutParams);
安卓编程 如何在Java代码里设置button的margin(外边距)?
1、获取按钮的2345影视源码LayoutParamsLinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)button.getLayoutParams();2、在LayoutParams中设置margin
layoutParams.setMargins(,php源码原创度,,5);//4个参数按顺序分别是左上右下3、把这个LayoutParams设置给按钮
button.setLayoutParams(layoutParams); //mView是maven引入本地源码控件2024-11-19 02:27
2024-11-19 01:59
2024-11-19 01:33
2024-11-19 01:20
2024-11-19 00:52
2024-11-19 00:42
2024-11-19 00:21
2024-11-19 00:17