Domanda

I am going to code a walkthrough tutorial for my app.

I wish the user will follow the step of the tutorial. So I want to force the user to click on a specific button but not other parts of the app.

My app has many UI components and some of them are added programmatically so disabling them one by one is not practical.

One immediate solution is that I make a transparent Activity to cover the original Activity. But I don't know how should I detect the touch event through the overlay Activity to operate the original Activity.

Or are there any better way to make a walkthrough tutorial on android apps without much affects to the original code? Tutorial is an adhoc feature and I dont want these adhoc features to ruin my coding with a lot of if-statement on every Activity.

Thank you.

È stato utile?

Soluzione

Activity won't work. Only the one at the top of the stack can process infos.

Simply add a semi-opaque view above the screen using a relativelayout

Then simply monitor the ontouch event of this view. If the touch is in the accepted zone of the tutorial, then let it bubble up to underneath control. If if is outside the accepted zone consume the event.

Altri suggerimenti

Button btn = new Button(getActivity());

btn.setText("Next");

// Adding  button to bottom
lv.addFooterView(btn);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top