【发布时间】:2012-09-11 04:08:20
【问题描述】:
我有一个自定义视图,它将被打包并添加到另一个项目中。在视图中,我想提供一个按钮选项。
这是我在 CustomView 类中的内容。
final CustomView currentView = (CustomView) findViewById(this.getId());
RelativeLayout.LayoutParams params = (new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT ));
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
closeButton.setLayoutParams(params);
currentView.addView(closeButton);
这都包含在一个RelativeLayout标签以及应用程序的其他对象中
一切都可以编译,但是在 CustomView 中,按钮是左对齐而不是右对齐。任何想法???
【问题讨论】:
标签: android mobile button layout view