我在我的项目中使用了伟大的ShowcaseView库。除此之外,我还使用这个非常棒的包装类ShowcaseViewExample来一个接一个地显示视图。
这很好,但我不知道如何使用手势。
目前为止的代码:
public void showcaseMainActivity() {
views = new ShowcaseViews(this, R.layout.showcase_view_template);
views.addView(new ShowcaseViews.ItemViewProperties(R.id.some_menu, R.string.showcase_title, R.string.showcase_message, ShowcaseView.ITEM_ACTION_ITEM));
views.addView(new ShowcaseViews.ViewProperties(R.id.showcaseButton, R.string.showcase_title, R.string.showcase_message));
views.show();
}我在哪里添加代码来为showcaseButton使用手势
发布于 2013-07-24 23:35:27
我不是那个回答你问题的人,我更像是一个不得不用我怀疑是错误的方式来做这件事的用户。
到目前为止,我只专注于让这个手势奏效。我不知道如何选择圆圈的大小
我想像你一样使用它,但它并没有给我带来任何东西,因为我没有找到在我添加视图的行中放置手势的位置。所以我按我的方式做了。
如下所示:
首先,我定义了展示视图:
Fragment thisFrag;
ShowcaseView sv;
ShowcaseView.ConfigOptions co;在我的创作中,我有这样一个:
co = new ShowcaseView.ConfigOptions();
thisFrag = this;然后,当我想要观看这个展示时,我调用了这个函数:
public static void showShowcase() {
// TODO Auto-generated method stub
co.hideOnClickOutside = false;
co.showcaseId = 1;
sv = ShowcaseView.insertShowcaseView(R.id.scrollView1, thisFrag.getActivity(), "Some funny text", " Smaller and funnier text ", co);
sv.animateGesture(200, 500, 200, 0);
OnShowcaseEventListener OSEvListner = new OnShowcaseEventListener() {
public void onShowcaseViewHide(ShowcaseView showcaseView) {
switch (co.showcaseId) {
case 1:
co.showcaseId = 2;
sv = ShowcaseView.insertShowcaseView(R.id.scrollView2, thisFrag.getActivity(), "How to scroll down", " ", co);
sv.setOnShowcaseEventListener(this);
sv.animateGesture(200, 500, 200, 0);
break;
case 2:
co.showcaseId = 3;
sv = ShowcaseView.insertShowcaseView(R.id.scrollView3, thisFrag.getActivity(),
"Do this to change tabs", "", co);
sv.setOnShowcaseEventListener(this);
sv.animateGesture(200, 500, 500, 500);
break;
case 3:
Main.switchTab(1);
OtherFragment.showShowcase();
}
}
@Override
public void onShowcaseViewShow(ShowcaseView showcaseView) {
// TODO Auto-generated method stub
}
};
sv.setOnShowcaseEventListener(OSEvListner);
} 希望有更好的方法来做这件事。
发布于 2014-02-16 06:13:04
在下面的示例中,使用方法:
ShowcaseView showcaseView = ShowcaseView.insertShowcaseView(new ViewTarget(yourView), activity, "this is title", "this is detail");
showcaseView.overrideButtonClick(new View.OnClickListener() {
@Override
public void onClick(View view) {
//your onClick code
}
});https://stackoverflow.com/questions/17846397
复制相似问题