如何获取 TapTargetView 的 BottomNavigation 项目视图参考
How to get BottomNavigation item view reference for TapTargetView
我有一个底部导航视图,我正在使用 TapTargetView 库来指导用户如何使用某些功能。如果我通过底部导航视图,那么 TapTargetView 将突出显示我不想要的整个底部栏。
我的问题是如何在底部导航视图中突出显示特定项目?
TapTargetView.showFor(this, TapTarget.forView(findViewById(R.id.home), "Home page", "We have cool features for you"),
new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
itemClicked();
}
});
谢谢。
我还没有实际尝试过,但我认为这应该有效
TapTargetView.showFor(this, TapTarget.forView(YOURBOTTOMNAVIGATIONVIEW.getChildAt(YOUR VIEW POSITION), "Home
page", "We have cool features for you"),
new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
itemClicked();
}
});
我找到了解决方案,就在这里:
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
TapTargetView.showFor(this, TapTarget.forView(bottomNavigationView.findViewById(R.id.home), "Home page", "We have cool features for you"),
new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
itemClicked();
}
});
我有一个底部导航视图,我正在使用 TapTargetView 库来指导用户如何使用某些功能。如果我通过底部导航视图,那么 TapTargetView 将突出显示我不想要的整个底部栏。
我的问题是如何在底部导航视图中突出显示特定项目?
TapTargetView.showFor(this, TapTarget.forView(findViewById(R.id.home), "Home page", "We have cool features for you"),
new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
itemClicked();
}
});
谢谢。
我还没有实际尝试过,但我认为这应该有效
TapTargetView.showFor(this, TapTarget.forView(YOURBOTTOMNAVIGATIONVIEW.getChildAt(YOUR VIEW POSITION), "Home
page", "We have cool features for you"),
new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
itemClicked();
}
});
我找到了解决方案,就在这里:
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
TapTargetView.showFor(this, TapTarget.forView(bottomNavigationView.findViewById(R.id.home), "Home page", "We have cool features for you"),
new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
itemClicked();
}
});