Comments (10)
Have you tried targeting MenuITem.getActionView()
?
from taptargetview.
@xiphirx Yes with TapTarget.forView, in onPrepareOptionsMenu, this method returns null. Possibly because it has just been inflated?
from taptargetview.
TapTarget.forToolbarMenuItem(...)
Should work fine. Are you sure you're setting an ID for the item and that it exists at the time you're trying to target it?
from taptargetview.
The menu is inflated in CreateOptionsMenu and after some changes to the items I am calling TapTarget.forToolbarMenuItem(toolbar, R.id.menu_mymenuitem.... etc) - This always resolves to null.
I took a look at the toolbar variable and although the MenuItem is in the mItems collection, it is not in the mActionItems collection. I am guessing but its either because it has been added by the fragment or that the item is not fully added to the toolbar in the onPrepareOptionsMenu method?
You see my reason for simply being able to supply a menuitem object :) (banging head on wall)
from taptargetview.
Supplying a MenuItem
does the library no good if getActionView
is returning null
. The library currently requires a view to target.
Could you possible provide a minimal code sample that would replicate this? I can take a further look afterwards
from taptargetview.
` @OverRide
public void onPrepareOptionsMenu(Menu menu) {
mShowSubscribedOnlyMenuItem = menu.findItem(R.id.menu_showsubscriptiononly);
Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
TapTargetView.showFor(getActivity(), // `this` is an Activity
TapTarget.forToolbarMenuItem(toolbar, R.id.menu_showsubscriptiononly, getText(R.string.taptarget_subscribeview_title), getText(R.string.taptarget_subscribeview_description))
// All options below are optional
.outerCircleColor(R.color.colorPrimary) // Specify a color for the outer circle
.targetCircleColor(R.color.white) // Specify a color for the target circle
.titleTextSize(30) // Specify the size (in sp) of the title text
.titleTextColor(R.color.white) // Specify the color of the title text
.descriptionTextSize(20) // Specify the size (in sp) of the description text
.descriptionTextColor(R.color.white) // Specify the color of the description text
.textColor(R.color.white) // Specify a color for both the title and description text
.dimColor(R.color.white) // If set, will dim behind the view with 30% opacity of the given color
.drawShadow(true) // Whether to draw a drop shadow or not
.cancelable(true) // Whether tapping outside the outer circle dismisses the view
.tintTarget(true) // Whether to tint the target view's color
.transparentTarget(false), // Specify whether the target is transparent (displays the content underneath)
//.icon(Drawable), // Specify a custom drawable to draw as the target
new TapTargetView.Listener() { // The listener can listen for regular clicks, long clicks or cancels` etc...
from taptargetview.
@xiphirx Apologies, this seems to be an issue with the menu element itself. It seems an actionViewClass is needed for the method getActionView to work. The library is now working with forView(MenuItemCompat.getActionView(MenuItem)
Thank you
from taptargetview.
@xiphirx It is worth noting however that this seems to introduce a problem as only menu items with an ActionViewClass will work. This is fine for something like a search action but for a standard menu item, im at a total loss. Appreciate the work.
from taptargetview.
I'm skeptical that is actually the case. It seems like something else is going on since the sample app utilizes the forToolbarMenuItem
function without issue.
from taptargetview.
@xiphirx I have used that function as per the sample app without a problem. The sample app calls this in onCreate within an activity. I am calling in the onPrepareOptionsMenu within a fragment as the visibility is changing there. I will dive further.
from taptargetview.
Related Issues (20)
- Alanz Stuff
- IllegalArgumentException but only on Huawei HUAWEI P30 lite
- Automation Testing in Appium HOT 1
- NPE crash when rotating device
- JCenter distribution HOT 2
- findViewById(R.id.target) not working HOT 1
- TapTargetView hides content HOT 1
- Apk size increases by 40mb
- Jetpack compose HOT 1
- On dismiss of TapTargetView, recycler view scrolls HOT 4
- How to set custom font to titleText
- How to hide highlight programmatically?
- No Means of Adding a Next Button on the sequence
- ฿@
- Is there any way to show the TapTargetView multiple times without sequence?
- Sync target
- TapTarget view showing only on ist recycler view item
- How to use this library to highlight a rectangular shape? HOT 3
- outer
- A way to add a view on top of TapTarget
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taptargetview.