我以编程方式使用线性布局创建按钮。但我无法更改注销按钮对齐到右侧。在Android中右侧实用设置按钮
在此先感谢...
我的代码是
lView = new LinearLayout(Main2Activity.this);
// lView.setPadding(0,150,0,0);
lView.setBackgroundColor(Color.parseColor("#EDFCFC"));
lView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
Button logout = new Button(Main2Activity.this);
logout.setText("Logout");
logout.setGravity(Gravity.CENTER);
logout.setBackgroundColor(Color.parseColor("#F53F37"));
lView.addView(logout);
他正在使用线性布局,您的代码不会与他一起工作! – EyadMhanna