我在我的应用程序中使用 ShowCaseView 库。我想将“确定”按钮向左移动。我使用了这段代码(在库中相同):
// The following code will reposition the OK button to the left.
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
int margin = ((Number) (getResources().getDisplayMetrics().density * 12))
.intValue();
lps.setMargins(margin, margin, margin, margin);
View showcasedView = findViewById(R.id.ib_next);
ViewTarget target = new ViewTarget(showcasedView);
ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
co.buttonLayoutParams = lps;
co.fadeInDuration = 1000;
co.fadeOutDuration = 1000;
ShowcaseView sv = ShowcaseView.insertShowcaseView(target, this,
R.string.showcase_title, R.string.showcase_details, co);
但它不起作用?谁能告诉问题出在哪里?